pigu_6

XS| Press Title

Jan 11th, 2013
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.06 KB | None | 0 0
  1. #==============================================================================
  2. # XS - Press Title
  3. # Author: Nicke
  4. # Created: 04/11/2012
  5. # Edited: 05/11/2012
  6. # Version: 1.0
  7. #==============================================================================
  8. # Instructions
  9. # -----------------------------------------------------------------------------
  10. # To install this script, open up your script editor and copy/paste this script
  11. # to an open slot below ? Materials but above ? Main. Remember to save.
  12. #
  13. # Press start title script.
  14. # This will enables a "Press Start" text before the actual title scene.
  15. # Like oldschool RPGs had.
  16. #
  17. # *** Only for RPG Maker VX Ace. ***
  18. #==============================================================================
  19. ($imported ||= {})["XAIL-PRESS-TITLE"] = true
  20.  
  21. module XAIL
  22. module PRESS_TITLE
  23. #--------------------------------------------------------------------------#
  24. # * Settings
  25. #--------------------------------------------------------------------------#
  26. # FONT = [name, size, color, bold, shadow]
  27. FONT = [["Verdana"], 32, Color.new(255,255,255), true, true]
  28.  
  29. # Setup the text here.
  30. # TEXT = [name, x, y]
  31. TEXT = ["-PRESS START-", 154, 90]
  32.  
  33. # The button to enter the title scene.
  34. # BUTTON = :symbol
  35. BUTTON = :C
  36.  
  37. # Goto scene.
  38. SCENE = Scene_Title
  39.  
  40. # Blink delay.
  41. # BLINK = [blink_in, blink_out]
  42. BLINK = [40, 40]
  43.  
  44. # Skip this scene?
  45. # SKIP = true/false
  46. SKIP = false
  47.  
  48. end
  49. end
  50. # *** Don't edit below unless you know what you are doing. ***
  51. #==============================================================================#
  52. # ** SceneManager
  53. #==============================================================================#
  54. class << SceneManager
  55.  
  56. alias xail_press_title_scenemanager_first_scene_class first_scene_class
  57. def first_scene_class(*args, &block)
  58. # // Method for first scene class.
  59. return xail_press_title_scenemanager_first_scene_class(*args, &block) if XAIL::PRESS_TITLE::SKIP
  60. $BTEST ? Scene_Battle : Scene_Press_Title
  61. end
  62.  
  63. end
  64. #==============================================================================#
  65. # ** Scene_Press_Title
  66. #==============================================================================#
  67. class Scene_Press_Title < Scene_Base
  68.  
  69. def initialize
  70. # // Method to initialize the scene.
  71. play_title_music
  72. create_background
  73. display_text
  74. end
  75.  
  76. def update
  77. # // Method to update the scene.
  78. super
  79. goto_scene
  80. end
  81.  
  82. def delay?(amount)
  83. # // Method to delay.
  84. return if Input.trigger?(XAIL::PRESS_TITLE::BUTTON)
  85. if amount.nil?
  86. loop do
  87. update_basic
  88. break if Input.trigger?(XAIL::PRESS_TITLE::BUTTON)
  89. end
  90. else
  91. amount.times do
  92. update_basic
  93. break if Input.trigger?(XAIL::PRESS_TITLE::BUTTON)
  94. end
  95. end
  96. end
  97.  
  98. def center_sprite(sprite)
  99. # // Method to center a sprite.
  100. sprite.ox = sprite.bitmap.width / 2
  101. sprite.oy = sprite.bitmap.height / 2
  102. sprite.x = Graphics.width / 2
  103. sprite.y = Graphics.height / 2
  104. end
  105.  
  106. def create_background
  107. # // Method to create the title background.
  108. @sprite1 = Sprite.new
  109. @sprite1.bitmap = Cache.title1($data_system.title1_name)
  110. @sprite2 = Sprite.new
  111. @sprite2.bitmap = Cache.title2($data_system.title2_name)
  112. center_sprite(@sprite1)
  113. center_sprite(@sprite2)
  114. end
  115.  
  116. def display_text
  117. # // Method to display the "press enter" text.
  118. text = XAIL::PRESS_TITLE::TEXT
  119. t = Sprite.new
  120. t.z = 5000
  121. t.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  122. t.bitmap.font.name = XAIL::PRESS_TITLE::FONT[0]
  123. t.bitmap.font.size = XAIL::PRESS_TITLE::FONT[1]
  124. t.bitmap.font.color = XAIL::PRESS_TITLE::FONT[2]
  125. t.bitmap.font.bold = XAIL::PRESS_TITLE::FONT[3]
  126. t.bitmap.font.shadow = XAIL::PRESS_TITLE::FONT[4]
  127. t.bitmap.draw_text(text[1], text[2], Graphics.width, Graphics.height, text[0])
  128. loop do
  129. break if Input.trigger?(XAIL::PRESS_TITLE::BUTTON)
  130. update_basic
  131. t.opacity = 255
  132. delay?(XAIL::PRESS_TITLE::BLINK[0])
  133. t.opacity = 0
  134. delay?(XAIL::PRESS_TITLE::BLINK[1])
  135. end
  136. t = nil, t.dispose unless t.nil?
  137. end
  138.  
  139. def goto_scene
  140. # // Method to go to specified scene.
  141. SceneManager.goto(XAIL::PRESS_TITLE::SCENE)
  142. end
  143.  
  144. def play_title_music
  145. # // Method to play the title music.
  146. $data_system.title_bgm.play
  147. RPG::BGS.stop
  148. RPG::ME.stop
  149. end
  150.  
  151. end
  152. #==============================================================================#
  153. # ** Scene_Title
  154. #==============================================================================#
  155. class Scene_Title < Scene_Base
  156.  
  157. def play_title_music
  158. # // Override title music for original scene.
  159. end
  160.  
  161. end # END OF FILE
  162.  
  163. #=*==========================================================================*=#
  164. # ** END OF FILE
  165. #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment