TheoAllen

Theo - Gameover Choice

Feb 26th, 2013
903
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 7.05 KB | None | 0 0
  1. # =============================================================================
  2. # ♫ ~ Gameover Choice by TheoAllen ~ ♫
  3. # Version : 1.0
  4. # Contact : www.rpgmakerid.com
  5. # =============================================================================
  6. # Requires : N/A
  7. # Rewrites method :
  8. # - Scene_Gameover - update
  9. # - Scene_Gameover - fadeout_speed
  10. # - Scene_Gameover - fadein_speed
  11. # Aliases method :
  12. # - Scene_Gameover - start
  13. # New class :
  14. # - Window_GameoverChoice
  15. # =============================================================================
  16. # ♫ UPDATES :
  17. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  18. # 2013.02.26 - Started and finished script
  19. #
  20. # =============================================================================
  21. # ♫ DESCRIPTION :
  22. # This script allow you to add command window in gameover screen which is
  23. # contains "Continue/Load", "Back to title", "End game"
  24. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  25. # ♫ INSTRUCTION :
  26. # Put this script below material but above main in script editor. Don't forget
  27. # to save.
  28. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  29. # ♫ HOW TO USE :
  30. # Just edit the configurations below
  31. # =============================================================================
  32. # ♫ TERMS OF USE :
  33. # - Credit isn't necessary. But if you want to, you can put "TheoAllen" in your
  34. #   credit list
  35. # - You may use and edit this script both for commercial and non-commercial or
  36. #   even adult game as long as u don't claim it yours.
  37. # - I'll be glad if you give me a free copy of your game if you use this script
  38. #   in your commercial project.
  39. # =============================================================================
  40. #
  41. # =============================================================================
  42. # ♫ CONFIGURATIONS ~ ♫
  43. # =============================================================================
  44. module THEOLIZED
  45.  
  46.   LOAD_COMMAND  = "Continue"      # Continue command
  47.   TITLE_COMMAND = "Back to title" # Go to title command
  48.   EXIT_COMMAND  = "Exit game"     # Exit game command
  49.  
  50.   # These settings are for screen transition. The higher value means the longer
  51.   # time needed
  52.   FADEOUT_SPEED = 60    # Fadeout speed (default: 60)
  53.   FADEIN_SPEED  = 120   # Fadein speed (default: 120)
  54.  
  55. end
  56. # =============================================================================
  57. # ♫ Do not edit unless you know what to do ~ ♫
  58. # =============================================================================
  59.  
  60. # =============================================================================
  61. # ♫ Window_GameoverChoice class ~ ♫
  62. # =============================================================================
  63.  
  64. class Window_GameoverChoice < Window_Command
  65.   #--------------------------------------------------------------------------
  66.   # ♫ Object Initialization
  67.   #--------------------------------------------------------------------------
  68.   def initialize
  69.     super(0, 0)
  70.     update_placement
  71.     select_symbol(:continue) if continue_enabled
  72.     self.openness = 0
  73.     open
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ♫ Get Window Width
  77.   #--------------------------------------------------------------------------
  78.   def window_width
  79.     return 160
  80.   end
  81.   #--------------------------------------------------------------------------
  82.   # ♫ Update Window Position
  83.   #--------------------------------------------------------------------------
  84.   def update_placement
  85.     self.x = (Graphics.width - width) / 2
  86.     self.y = (Graphics.height * 1.6 - height) / 2
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ♫ Create Command List
  90.   #--------------------------------------------------------------------------
  91.   def make_command_list
  92.     add_command(THEOLIZED::LOAD_COMMAND , :continue, continue_enabled)
  93.     add_command(THEOLIZED::TITLE_COMMAND, :title)
  94.     add_command(THEOLIZED::EXIT_COMMAND , :shutdown)
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ♫ Get Activation State of Continue
  98.   #--------------------------------------------------------------------------
  99.   def continue_enabled
  100.     DataManager.save_file_exists?
  101.   end
  102. end
  103.  
  104. # =============================================================================
  105. # ♫ Scene_Gameover ~ ♫
  106. # =============================================================================
  107.  
  108. class Scene_Gameover < Scene_Base
  109.   #--------------------------------------------------------------------------
  110.   # ♫ Aliased : Start Processing
  111.   #--------------------------------------------------------------------------
  112.   alias theo_go_choice_start start
  113.   def start
  114.     theo_go_choice_start
  115.     create_gameover_choice
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # ♫ Create Choice Window
  119.   #--------------------------------------------------------------------------
  120.   def create_gameover_choice
  121.     @window_choice = Window_GameoverChoice.new
  122.     @window_choice.set_handler(:continue, method(:command_continue))
  123.     @window_choice.set_handler(:title,    method(:goto_title))
  124.     @window_choice.set_handler(:shutdown, method(:command_shutdown))
  125.   end
  126.   #--------------------------------------------------------------------------
  127.   # ♫ Continue Command
  128.   #--------------------------------------------------------------------------
  129.   def command_continue
  130.     close_command_window
  131.     SceneManager.call(Scene_Load)
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ♫ Close command window
  135.   #--------------------------------------------------------------------------
  136.   def close_command_window
  137.     @window_choice.close
  138.     update until @window_choice.close?
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ♫ Shutdown Command
  142.   #--------------------------------------------------------------------------
  143.   def command_shutdown
  144.     close_command_window
  145.     fadeout_all
  146.     SceneManager.exit
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # ♫ Overwrite : Frame Update
  150.   #--------------------------------------------------------------------------
  151.   def update
  152.     super
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ♫ Overwrite : Get Fade Out Speed
  156.   #--------------------------------------------------------------------------
  157.   def fadeout_speed
  158.     return THEOLIZED::FADEOUT_SPEED
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # ♫ Overwrite : Get Fade In Speed
  162.   #--------------------------------------------------------------------------
  163.   def fadein_speed
  164.     return THEOLIZED::FADEIN_SPEED
  165.   end
  166.  
  167. end
  168. # =============================================================================
  169. # ♫ End of script ~ ♫
  170. # =============================================================================
Advertisement
Add Comment
Please, Sign In to add comment