khanhdu

DT's GameOver +

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