Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #===============================================================================
  2. #
  3. # DT's GameOver +
  4. # Author: DoctorTodd
  5. # Date (04/27/2012)
  6. # Version: (1.0.0) (VXA)
  7. # Level: (Simple)
  8. # Email: Todd@beacongames.com
  9. #
  10. #===============================================================================
  11. #
  12. # NOTES: 1)This script will only work with ace.
  13. #
  14. #===============================================================================
  15. #
  16. # Description: Adds an option window to the GameOver screen.
  17. #
  18. # Credits: Me (DoctorTodd)
  19. #
  20. #===============================================================================
  21. #
  22. # Instructions
  23. # Paste above main.
  24. #
  25. #===============================================================================
  26. #
  27. # Contact me for commercial use, other wise just credit me and don't repost
  28. # without my permission.
  29. #
  30. #===============================================================================
  31. #
  32. # Editing begins 37 and ends on 41.
  33. #
  34. #===============================================================================
  35. module DTGOP
  36.  
  37.   #The Y coordinate of the Command Window
  38.   COMWINY = 300
  39.  
  40.   #The X coordinate of the Command Window
  41.   COMWINX = 180
  42.  
  43. end
  44. #==============================================================================
  45. # ** Window_MenuCommand
  46. #------------------------------------------------------------------------------
  47. #  This command window appears on the menu screen.
  48. #==============================================================================
  49.  
  50. class Window_GameOverCommand < Window_Command
  51.   #--------------------------------------------------------------------------
  52.   # * Object Initialization
  53.   #--------------------------------------------------------------------------
  54.   def initialize
  55.     super(0, 0)
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # * Get Window Width
  59.   #--------------------------------------------------------------------------
  60.   def window_width
  61.     return 160
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # * Get Number of Lines to Show
  65.   #--------------------------------------------------------------------------
  66.   def visible_line_number
  67.     item_max
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # * Create Command List
  71.   #--------------------------------------------------------------------------
  72.   def make_command_list
  73.     add_load_command
  74.     add_title_command
  75.     add_original_commands
  76.     add_quit_command
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   # * Add load to Command List
  80.   #--------------------------------------------------------------------------
  81.   def add_load_command
  82.    add_command("Chơi Lại", :load)
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # * For Adding Original Commands
  86.   #--------------------------------------------------------------------------
  87.   def add_original_commands
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # * Add Title to Command List
  91.   #--------------------------------------------------------------------------
  92.   def add_title_command
  93.     add_command("Trang Chủ", :title)
  94.   end
  95.   #------------------------------------------------------------------------
  96.   # * Add quit Game to Command List
  97.   #--------------------------------------------------------------------------
  98.   def add_quit_command
  99.     add_command("Thoát", :quit)
  100.   end
  101. end
  102. #==============================================================================
  103. # ** Scene_Gameover
  104. #------------------------------------------------------------------------------
  105. #  This class performs game over screen processing.
  106. #==============================================================================
  107.  
  108. class Scene_Gameover < Scene_Base
  109.   #--------------------------------------------------------------------------
  110.   # * Start Processing
  111.   #--------------------------------------------------------------------------
  112.   def start
  113.     super
  114.     play_gameover_music
  115.     fadeout_frozen_graphics
  116.     create_background
  117.     create_command_window
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # * Termination Processing
  121.   #--------------------------------------------------------------------------
  122.   def terminate
  123.     super
  124.     dispose_background
  125.   end
  126.   #--------------------------------------------------------------------------
  127.   # * Create Command Window
  128.   #--------------------------------------------------------------------------
  129.   def create_command_window
  130.     @command_window =  Window_GameOverCommand.new
  131.     @command_window.set_handler(:load,    method(:command_load))
  132.     @command_window.set_handler(:title,  method(:command_title))
  133.     @command_window.set_handler(:quit,    method(:command_quit))
  134.     @command_window.y = (DTGOP::COMWINY)
  135.     @command_window.x = (DTGOP::COMWINX)
  136.     end
  137.   #--------------------------------------------------------------------------
  138.   # * Execute Transition
  139.   #--------------------------------------------------------------------------
  140.   def perform_transition
  141.     Graphics.transition(fadein_speed)
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # * Play Music on Game Over Screen
  145.   #--------------------------------------------------------------------------
  146.   def play_gameover_music
  147.     RPG::BGM.stop
  148.     RPG::BGS.stop
  149.     $data_system.gameover_me.play
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # * Fade Out Frozen Graphics
  153.   #--------------------------------------------------------------------------
  154.   def fadeout_frozen_graphics
  155.     Graphics.transition(fadeout_speed)
  156.     Graphics.freeze
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # * Create Background
  160.   #--------------------------------------------------------------------------
  161.   def create_background
  162.     @sprite = Sprite.new
  163.     @sprite.bitmap = Cache.system("GameOver")
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # * Free Background
  167.   #--------------------------------------------------------------------------
  168.   def dispose_background
  169.     @sprite.bitmap.dispose
  170.     @sprite.dispose
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # * Get Fade Out Speed
  174.   #--------------------------------------------------------------------------
  175.   def fadeout_speed
  176.     return 60
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # * Get Fade In Speed
  180.   #--------------------------------------------------------------------------
  181.   def fadein_speed
  182.     return 120
  183.   end
  184.   #--------------------------------------------------------------------------
  185.   # * [Load] Command
  186.   #--------------------------------------------------------------------------
  187.   def command_load
  188.     SceneManager.call(Scene_Load)
  189.   end
  190.   #--------------------------------------------------------------------------
  191.   # * [Title] Command
  192.   #--------------------------------------------------------------------------
  193.   def command_title
  194.     SceneManager.call(Scene_Title)
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # * [Quit] Command
  198.   #--------------------------------------------------------------------------
  199.   def command_quit
  200.     fadeout_all
  201.     SceneManager.exit
  202.   end
  203. end