Advertisement
jwideman

Map GameOver (encryption friendly)

Mar 14th, 2016
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.92 KB | None | 0 0
  1. #----------------------------------------------------------------------------
  2. # Map GameOver (encryption friendly)
  3. #----------------------------------------------------------------------------
  4. # Created by Joel Wideman
  5. #----------------------------------------------------------------------------
  6. # For use with RPG Maker VX Ace, compatibility with other software is unknown
  7. #----------------------------------------------------------------------------
  8. # Please credit if you use or modify.
  9. # You may use in commercial or non-commercial works.
  10. # You may modify, including translation, and redistribute.
  11. # Please don't redistribute unaltered.
  12. #----------------------------------------------------------------------------
  13. # Overrides: Scene_Gameover and Window_GameEnd
  14. #----------------------------------------------------------------------------
  15. # Change the GameOver scene to use the map as background and add a menu to
  16. # reload the game or quit directly, instead of going to the title screen.
  17. # You can use an image for the game over text. Image should be named
  18. # "Game_Over.png" (no quotes) and placed in "Graphics/System/"
  19. #----------------------------------------------------------------------------
  20. module JW
  21. # change this to false to print the text
  22. MAPGO = true
  23. end
  24.  
  25. class Scene_Gameover < Scene_Base
  26.  
  27. #--------------------------------------------------------------------------
  28. # Override: start
  29. # Removes the call to fadeout the graphics
  30. #--------------------------------------------------------------------------
  31. def start
  32. super
  33. play_gameover_music
  34. create_background
  35. JW::MAPGO ? create_foreground : draw_game_over
  36. create_command_window
  37. end
  38.  
  39. #--------------------------------------------------------------------------
  40. # Override: update
  41. # Removes the call to go to the title scene
  42. #--------------------------------------------------------------------------
  43. def update
  44. super
  45. end
  46.  
  47. #--------------------------------------------------------------------------
  48. # Override: create_background
  49. # Replaces the GameOver image with the background
  50. #--------------------------------------------------------------------------
  51. def create_background
  52. @background_sprite = Sprite.new
  53. @background_sprite.bitmap = SceneManager.background_bitmap
  54. @background_sprite.color.set(16, 16, 16, 128)
  55. end
  56.  
  57. #--------------------------------------------------------------------------
  58. # Create Foreground
  59. #--------------------------------------------------------------------------
  60. def create_foreground
  61. @foreground_sprite = Sprite.new
  62. @foreground_sprite.bitmap = Cache.system("Game_Over")
  63. end
  64.  
  65. #--------------------------------------------------------------------------
  66. # Override: dispose_background
  67. # Changed to free foreground_sprite and background_sprite
  68. #--------------------------------------------------------------------------
  69. def dispose_background
  70. @foreground_sprite.bitmap.dispose
  71. @foreground_sprite.dispose
  72. @background_sprite.bitmap.dispose
  73. @background_sprite.dispose
  74. end
  75.  
  76. #--------------------------------------------------------------------------
  77. # * Draw Game Over
  78. #--------------------------------------------------------------------------
  79. def draw_game_over
  80. @foreground_sprite = Sprite.new
  81. @foreground_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  82. @foreground_sprite.z = 100
  83. @foreground_sprite.bitmap.font.size = 96
  84. rect = Rect.new(0, 0, Graphics.width, Graphics.height / 2)
  85. @foreground_sprite.bitmap.draw_text(rect, "Game Over", 1)
  86. end
  87.  
  88. #--------------------------------------------------------------------------
  89. # Override: create_command_window
  90. # Removes cancel and adds continue
  91. #--------------------------------------------------------------------------
  92. def create_command_window
  93. @command_window = Window_GameOver.new
  94. @command_window.set_handler(:continue, method(:command_continue))
  95. @command_window.set_handler(:to_title, method(:command_to_title))
  96. @command_window.set_handler(:shutdown, method(:command_shutdown))
  97. end
  98. #--------------------------------------------------------------------------
  99. # * [Continue] Command
  100. #--------------------------------------------------------------------------
  101. def command_continue
  102. close_command_window
  103. SceneManager.call(Scene_Load)
  104. end
  105. #--------------------------------------------------------------------------
  106. # Copied from Scene_End
  107. # Terribly kludgy, but I don't know the right way to do it, if you even can
  108. #--------------------------------------------------------------------------
  109. #--------------------------------------------------------------------------
  110. # * Close Command Window
  111. #--------------------------------------------------------------------------
  112. def close_command_window
  113. @command_window.close
  114. update until @command_window.close?
  115. end
  116. #--------------------------------------------------------------------------
  117. # * [Go to Title] Command
  118. #--------------------------------------------------------------------------
  119. def command_to_title
  120. close_command_window
  121. fadeout_all
  122. SceneManager.goto(Scene_Title)
  123. end
  124. #--------------------------------------------------------------------------
  125. # * [Shut Down] Command
  126. #--------------------------------------------------------------------------
  127. def command_shutdown
  128. close_command_window
  129. fadeout_all
  130. SceneManager.exit
  131. end
  132. end
  133.  
  134. class Window_GameOver < Window_GameEnd
  135. #--------------------------------------------------------------------------
  136. # * Create Command List
  137. # Removes cancel and adds continue
  138. #--------------------------------------------------------------------------
  139. def make_command_list
  140. add_command(Vocab::continue, :continue)
  141. add_command(Vocab::to_title, :to_title)
  142. add_command(Vocab::shutdown, :shutdown)
  143. end
  144. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement