Black_Mage

Credits Window RMVXAce Script

Mar 4th, 2014 (edited)
942
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.05 KB | None | 0 0
  1. #------------------------------------------------------------------------------
  2. # Add Credits on the Title Screen.
  3. #
  4. # https://burningwizard.wordpress.com/2014/03/04/rgss3-credits-script/
  5. #------------------------------------------------------------------------------
  6.  
  7. =begin
  8. #==============================================================================
  9. # MIT License
  10. #==============================================================================
  11. Copyright 2014-2024 Black Mage
  12.  
  13. Permission is hereby granted, free of charge, to any person obtaining a copy of
  14. this software and associated documentation files (the “Software”), to deal in
  15. the Software without restriction, including without limitation the rights to use,
  16. copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
  17. Software, and to permit persons to whom the Software is furnished to do so,
  18. subject to the following conditions:
  19.  
  20. The above copyright notice and this permission notice shall be included in all
  21. copies or substantial portions of the Software.
  22.  
  23. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  25. FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  26. COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  27. IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  28. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  29. #==============================================================================
  30. =end
  31.  
  32. #==============================================================================
  33. # Changelog
  34. #==============================================================================
  35. # Version 1.2 (2024 - 8 - 2)
  36. #   - Change the way the credits is set up in the script.
  37. #   - Make the Credits scrollable.
  38. #
  39. # Version 1.1 (2014 - 7 - 18)
  40. #   - Fix some issues.
  41. #
  42. # Version 1.0 (2014 - 3 - 4)
  43. #   - Initial version.
  44. #==============================================================================
  45.  
  46. #-------------------------------------------------------------------------------
  47. # Settings
  48. #-------------------------------------------------------------------------------
  49. module BLACK
  50.  
  51.   # A credit example. It starts with " and end with another ".
  52.   Credits = "
  53. ---------------------------------------------------------------------------
  54. Example Game
  55. ---------------------------------------------------------------------------
  56. Developed by: Black Mage
  57.  
  58. Engine: RPG Maker VX Ace
  59.  
  60.  
  61. Director & Producer: Black Mage
  62.  
  63. Storywriter:
  64. Black Mage
  65.  
  66. Programmer:
  67. Black Mage
  68.  
  69. " #Don't erase this.
  70.  
  71. end
  72. # End of Settings -------------------------------------------------------------
  73.  
  74. #------------------------------------------------------------------------------
  75. # * Beyond this is the sacred land of code. You need programming qualification
  76. #   to dwelve deeper, or it'll cause many unnecessary problems. Proceed on your
  77. #   own risk.
  78. #------------------------------------------------------------------------------
  79.  
  80. class Window_TitleCommand < Window_Command
  81.   def make_command_list
  82.     add_command(Vocab::new_game, :new_game)
  83.     add_command(Vocab::continue, :continue, continue_enabled)
  84.     add_command("Credits", :credits)
  85.     add_command(Vocab::shutdown, :shutdown)
  86.   end
  87. end
  88.  
  89. class Scene_Title < Scene_Base
  90.   def create_command_window
  91.     @command_window = Window_TitleCommand.new
  92.     @command_window.set_handler(:new_game, method(:command_new_game))
  93.     @command_window.set_handler(:continue, method(:command_continue))
  94.     @command_window.set_handler(:credits,  method(:command_credits))
  95.     @command_window.set_handler(:shutdown, method(:command_shutdown))
  96.   end
  97.   def command_credits
  98.     close_command_window
  99.     SceneManager.call(Scene_Credits)
  100.   end
  101. end
  102.  
  103. class Window_Credits < Window_Base
  104.   def initialize; super(0, 0, window_width, 416); refresh; end
  105.   def window_width; Graphics.width; end
  106.   def refresh
  107.     contents.clear
  108.     self.contents = Bitmap.new(width - 24, line_height*(BLACK::Credits.count("\n") + 1))
  109.     draw_text_ex(0,0,BLACK::Credits)
  110.   end
  111.   def open; refresh; super; end
  112.   def update
  113.     super
  114.     process_cursor_move
  115.   end
  116.   def process_cursor_move
  117.     return if !self.active
  118.     press_down if Input.repeat?(:DOWN)
  119.     press_up   if Input.repeat?(:UP)
  120.   end
  121.   def press_down
  122.     self.oy += line_height if self.oy < [self.contents.height - self.height + 24, 0].max
  123.   end  
  124.   def press_up
  125.     self.oy -= line_height if self.oy > 0
  126.   end  
  127. end
  128.  
  129. class Scene_Credits < Scene_MenuBase
  130.   def start; super; create_credits_window; end
  131.   def create_credits_window
  132.     @credits_window = Window_Credits.new
  133.     @credits_window.x = 0
  134.     @credits_window.y = 0
  135.   end
  136.   def update; super; update_credits; end  
  137.   def update_credits
  138.     return credits_return     if Input.trigger?(:C)
  139.     return credits_return     if Input.trigger?(:B)
  140.   end
  141.   def credits_return; Sound.play_cancel; SceneManager.goto(Scene_Title); end
  142. end
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment