Advertisement
AriArk

AriArk's Game Over Choices v1.20

Sep 3rd, 2013
559
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.83 KB | None | 0 0
  1. #----------------------------------------------------------------------------
  2. # AriArk's Game Over Choices
  3. # Version 1.20
  4. #----------------------------------------------------------------------------
  5. # This is my first script, it obviously wont be very good, just adds to title
  6. # and shut down to the game over screen. You can add your own choices too.
  7. #----------------------------------------------------------------------------
  8. #----------------------------------------------------------------------------
  9. #                              CUSTOM SETTINGS
  10. #----------------------------------------------------------------------------
  11. # Where it says one letter in green (x, y), put whatever there. You must
  12. # remember those letters. Don't change if you only want to title and shutdown.
  13. #----------------------------------------------------------------------------
  14. class Window_Gameoverchoice < Window_Command
  15. #----------------------------------------------------------------------------
  16.   def make_command_list
  17. #   add_command("Text Shown", :x)                                   # Example
  18.     add_command(Vocab::to_title, :to_title)
  19.     add_command(Vocab::shutdown, :shutdown)
  20.   end
  21. end
  22. #----------------------------------------------------------------------------
  23. class Scene_Gameover < Scene_Base
  24. #----------------------------------------------------------------------------
  25.   def create_command_window
  26.     @command_window = Window_Gameoverchoice.new
  27. #   @command_window.set_handler(:x, method(:comand_y))              # Example
  28.     @command_window.set_handler(:to_title, method(:command_to_title))
  29.     @command_window.set_handler(:shutdown, method(:command_shutdown))
  30.   end
  31. #----------------------------------------------------------------------------
  32. # Copy paste this underneath to make more
  33. #----------------------------------------------------------------------------
  34.    def command_y
  35.     close_command_window
  36.     fadeout_all
  37.     SceneManager.goto(Scene_z)  # You put what scene to call here
  38.   end
  39. end
  40. #----------------------------------------------------------------------------
  41. #                          END OF CUSTOM SETTINGS
  42. #----------------------------------------------------------------------------
  43. #            DO NOT EDIT ANYTHING BELOW IF YOU DO NOT KNOW RUBY!!!
  44. #----------------------------------------------------------------------------
  45. class Window_Gameoverchoice < Window_Command
  46.  
  47.   def initialize
  48.     super(0, 0)
  49.     update_placement
  50.     self.openness = 0
  51.     open
  52.   end
  53.  
  54.   def window_width
  55.     return 160
  56.   end
  57.  
  58.   def update_placement
  59.     self.x = (Graphics.width - width) / 2
  60.     self.y = (Graphics.height - height) / 2
  61.   end
  62.  
  63. end
  64. class Scene_Gameover < Scene_Base
  65.  
  66.   def start
  67.     super
  68.     play_gameover_music
  69.     fadeout_frozen_graphics
  70.     create_background
  71.     create_command_window
  72.   end
  73.  
  74.   def terminate
  75.     super
  76.     dispose_background
  77.   end
  78.  
  79.   def perform_transition
  80.     Graphics.transition(fadein_speed)
  81.   end
  82.  
  83.   def play_gameover_music
  84.     RPG::BGM.stop
  85.     RPG::BGS.stop
  86.     $data_system.gameover_me.play
  87.   end
  88.  
  89.   def fadeout_frozen_graphics
  90.     Graphics.transition(fadeout_speed)
  91.     Graphics.freeze
  92.   end
  93.  
  94.   def create_background
  95.     @sprite = Sprite.new
  96.     @sprite.bitmap = Cache.system("GameOver")
  97.   end
  98.  
  99.   def dispose_background
  100.     @sprite.bitmap.dispose
  101.     @sprite.dispose
  102.   end
  103.  
  104.   def fadeout_speed
  105.     return 60
  106.   end
  107.  
  108.   def fadein_speed
  109.     return 120
  110.   end
  111.  
  112.   def goto_title
  113.     fadeout_all
  114.     SceneManager.goto(Scene_Title)
  115.   end
  116.  
  117.   def close_command_window
  118.     @command_window.close
  119.     update until @command_window.close?
  120.   end
  121.  
  122.   def command_to_title
  123.     close_command_window
  124.     fadeout_all
  125.     SceneManager.goto(Scene_Title)
  126.   end
  127.  
  128.   def command_shutdown
  129.     close_command_window
  130.     fadeout_all
  131.     SceneManager.exit
  132.   end
  133. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement