Advertisement
MakerSystems

RPG Maker VX Ace - Split Transitions

Nov 26th, 2014
1,097
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.67 KB | None | 0 0
  1. %Q(
  2. ╔════╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═════╗
  3. ║ ╔══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╗ ║
  4. ╠─╣ Split Transitions ╠─╣
  5. ╠─╣ by RPG Maker Source. ╠─╣
  6. ╠─╣ www.rpgmakersource.com ╠─╣
  7. ║ ╚══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╝ ║
  8. ╠════╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═╤═╩═════╣
  9. ║ ┌────┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴─────┐ ║
  10. ╠─┤ Version 1.0.0 24/11/14 DD/MM/YY ├─╣
  11. ║ └────┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┘ ║
  12. ╠══════╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══════╣
  13. ║ ║
  14. ║ This work is protected by the following license: ║
  15. ║ ╔══════════════════════════════════════════════════════════════════╗ ║
  16. ║ │ │ ║
  17. ║ │ Copyright © 2014 Maker Systems. │ ║
  18. ║ │ │ ║
  19. ║ │ This software is provided 'as-is', without any kind of │ ║
  20. ║ │ warranty. Under no circumstances will the author be held │ ║
  21. ║ │ liable for any damages arising from the use of this software. │ ║
  22. ║ │ │ ║
  23. ║ │ Permission is granted to anyone to use this software on their │ ║
  24. ║ │ free or commercial games made with a legal copy of RPG Maker │ ║
  25. ║ │ VX Ace, as long as Maker Systems - RPG Maker Source is │ ║
  26. ║ │ credited within the game. │ ║
  27. ║ │ │ ║
  28. ║ │ Selling this code or any portions of it 'as-is' or as part of │ ║
  29. ║ │ another code, is not allowed. │ ║
  30. ║ │ │ ║
  31. ║ │ The original header, which includes this copyright notice, │ ║
  32. ║ │ must not be edited or removed from any verbatim copy of the │ ║
  33. ║ │ sotware nor from any edited version. │ ║
  34. ║ │ │ ║
  35. ║ ╚══════════════════════════════════════════════════════════════════╝ ║
  36. ║ ║
  37. ║ ║
  38. ╠══════════════════════════════════════════════════════════════════════════════╣
  39. ║ 1. VERSION HISTORY. ▼ ║
  40. ╠══════════════════════════════════════════════════════════════════════════════╣
  41. ║ ║
  42. ║ • Version 1.0.0, 24/11/14 - (DD/MM/YY). ║
  43. ║ ║
  44. ╠══════════════════════════════════════════════════════════════════════════════╣
  45. ╠══════════════════════════════════════════════════════════════════════════════╣
  46. ║ 2. USER MANUAL. ▼ ║
  47. ╠══════════════════════════════════════════════════════════════════════════════╣
  48. ║ ║
  49. ║ ┌──────────────────────────────────────────────────────────────────────────┐ ║
  50. ║ │ ■ Introduction. │ ║
  51. ║ └┬┬┬┬──────────────────────────────────────────────────────────────────┬┬┬┬┘ ║
  52. ║ ║
  53. ║ Hello there! This script is "plug and play", you can simply insert it into ║
  54. ║ your project and it will perform flawlessly. ║
  55. ║ ║
  56. ║ This script makes a nifty transition effect between every Scene of your ║
  57. ║ game. ║
  58. ║ The effect will be performed whenever a Scene changes, for example, when ║
  59. ║ you enter the menu from the map, or when you enter the inventory screen, ║
  60. ║ when you go back to the menu, when you go back to the map, and so on. ║
  61. ║ ║
  62. ║ This is a great addition to make your game look more polished, since the ║
  63. ║ default way RPG Maker Ace handles scene transitions (except for battle ║
  64. ║ ones) is to just make the new Scene violently appear in the screen. ║
  65. ║ ║
  66. ║ Works with custom menu scripts or custom scenes too. ║
  67. ║ ║
  68. ║ We hope you enjoy it. ║
  69. ║ ║
  70. ║ Thanks for choosing our products. ║
  71. ║ ║
  72. ║ ┌──────────────────────────────────────────────────────────────────────────┐ ║
  73. ║ │ ■ Configuration. │ ║
  74. ║ └┬┬┬┬──────────────────────────────────────────────────────────────────┬┬┬┬┘ ║
  75. ║ ║
  76. ║ "How do I change the speed of the effect?" ║
  77. ║ Right click anywhere in the script editor and select "Find" (or CTRL + F), ║
  78. ║ search for "SPEED" (without quotation marks). ║
  79. ║ ║
  80. ║ You will see something like "SPEED = 16" ║
  81. ║ ║
  82. ║ Set the number after the equality sign to any numer you like, bigger or ║
  83. ║ equal than 1. The bigger the number, the faster the effect is performed. ║
  84. ║ Small numbers result in a slower transition, default value is 16. ║
  85. ║ ║
  86. ║ "How do I exclude some Scenes from the effect?" ║
  87. ║ Right click anywhere in the script editor and select "Find" (or CTRL + F), ║
  88. ║ searh for "EXCLUDE" (without quotation marks). ║
  89. ║ ║
  90. ║ You will see something like "EXCLUDE = 'Scene_Title Scene_Battle'" ║
  91. ║ ║
  92. ║ To exclude more Scenes from the effect, simply add their names between ║
  93. ║ those single quotes. ║
  94. ║ For example, to exclude the Shop Scene too: ║
  95. ║ ║
  96. ║ EXCLUDE = 'Scene_Title Scene_Battle Scene_Shop' ║
  97. ║ ║
  98. ║ ║
  99. ╠══════════════════════════════════════════════════════════════════════════════╣
  100. ╠══════════════════════════════════════════════════════════════════════════════╣
  101. ║ 3. NOTES. ▼ ║
  102. ╠══════════════════════════════════════════════════════════════════════════════╣
  103. ║ ║
  104. ║ Have fun and enjoy! ║
  105. ║ ║
  106. ╠══════════════════════════════════════════════════════════════════════════════╣
  107. ╠══════════════════════════════════════════════════════════════════════════════╣
  108. ║ 4. CONTACT. ▼ ║
  109. ╠══════════════════════════════════════════════════════════════════════════════╣
  110. ║ ║
  111. ║ Keep in touch with us and be the first to know about new releases: ║
  112. ║ ║
  113. ║ www.rpgmakersource.com ║
  114. ║ www.facebook.com/RPGMakerSource ║
  115. ║ www.twitter.com/RPGMakerSource ║
  116. ║ www.youtube.com/user/RPGMakerSource ║
  117. ║ ║
  118. ║ Get involved! Have an idea for a system? Let us know. ║
  119. ║ ║
  120. ║ Spread the word and help us reach more people so we can continue creating ║
  121. ║ awesome resources for you! ║
  122. ║ ║
  123. ╚══════════════════════════════════════════════════════════════════════════════╝)
  124.  
  125. #==============================================================================
  126. # ** MakerSystems [NEW]
  127. #------------------------------------------------------------------------------
  128. # Module for our Systems.
  129. #==============================================================================
  130.  
  131. module MakerSystems
  132.  
  133. #============================================================================
  134. # ** Split Transitions [NEW]
  135. #----------------------------------------------------------------------------
  136. # This module contains some configurable parameters.
  137. #============================================================================
  138.  
  139. module SplitTransitions
  140.  
  141. #------------------------------------------------------------------------
  142. # * Scenes to EXCLUDE. [OPT]
  143. #------------------------------------------------------------------------
  144. EXCLUDE = 'Scene_Title Scene_Battle'
  145. #------------------------------------------------------------------------
  146. # * SPEED of the stripe's movement. [OPT]
  147. #------------------------------------------------------------------------
  148. SPEED = 16
  149.  
  150. end
  151.  
  152. end
  153.  
  154. #==============================================================================
  155. # ** Scene_Base [MOD]
  156. #------------------------------------------------------------------------------
  157. # This is a super class of all scenes within the game.
  158. #==============================================================================
  159.  
  160. class Scene_Base
  161.  
  162. # This will hold the screen's Bitmap.
  163. @@_ms_split_transitions_screen = nil
  164. # This holds the current mode.
  165. @@_ms_split_transitions_switch = 0
  166.  
  167. #--------------------------------------------------------------------------
  168. # * Alias Pre Terminate. [NEW]
  169. #--------------------------------------------------------------------------
  170. alias_method(:ms_split_transitions_original_pre_terminate, :pre_terminate)
  171. #--------------------------------------------------------------------------
  172. # * Pre Terminate. [MOD]
  173. #--------------------------------------------------------------------------
  174. def pre_terminate
  175. # Prepares Split Transition unless origin or target are to be excluded.
  176. exclude = MakerSystems::SplitTransitions::EXCLUDE
  177. unless exclude =~ /#{SceneManager.scene.class.name}/ ||
  178. exclude =~ /#{@ms_split_transitions_origin_scene}/
  179. @@_ms_split_transitions_screen = Graphics.snap_to_bitmap
  180. end
  181. # Original method.
  182. ms_split_transitions_original_pre_terminate
  183. end
  184. #--------------------------------------------------------------------------
  185. # * Alias Post Start. [NEW]
  186. #--------------------------------------------------------------------------
  187. alias_method(:ms_split_transitions_original_post_start, :post_start)
  188. #--------------------------------------------------------------------------
  189. # * Post Start. [MOD]
  190. #--------------------------------------------------------------------------
  191. def post_start
  192. # If Split Transition was prepared.
  193. if @@_ms_split_transitions_screen
  194. # Vertical Opening.
  195. if @@_ms_split_transitions_switch == 1
  196. # Calculates stripe size.
  197. stripe_width = @@_ms_split_transitions_screen.width
  198. stripe_height = @@_ms_split_transitions_screen.height / 2
  199. # SPEED. Only Y axis will move.
  200. plus_x = 0
  201. plus_y = MakerSystems::SplitTransitions::SPEED
  202. # Origin position for both stripes.
  203. x1 = 0
  204. y1 = 0
  205. x2 = 0
  206. y2 = stripe_height
  207. # Target position.
  208. tx = 0
  209. ty = Graphics.height
  210. # Switches transition mode.
  211. @@_ms_split_transitions_switch = 0
  212. # Horizontal Opening.
  213. else
  214. # Calculates stripe size.
  215. stripe_width = @@_ms_split_transitions_screen.width / 2
  216. stripe_height = @@_ms_split_transitions_screen.height
  217. # SPEED. Only X axis will move.
  218. plus_x = MakerSystems::SplitTransitions::SPEED
  219. plus_y = 0
  220. # Origin position for both stripes.
  221. x1 = 0
  222. y1 = 0
  223. x2 = stripe_width
  224. y2 = 0
  225. # Target position.
  226. tx = Graphics.width
  227. ty = 0
  228. # Switches transition mode.
  229. @@_ms_split_transitions_switch = 1
  230. end
  231. # Creates first stripe Sprite in the correct position.
  232. sprite_1 = Sprite.new
  233. sprite_1.x = x1
  234. sprite_1.y = y1
  235. sprite_1.z = 99999999
  236. # Sets Bitmap for the stripe, drawn from the correct screen position.
  237. rect_1 = Rect.new(x1, y1, stripe_width, stripe_height)
  238. sprite_1.bitmap = Bitmap.new(stripe_width, stripe_height)
  239. sprite_1.bitmap.blt(0, 0, @@_ms_split_transitions_screen, rect_1)
  240. # Creates second stripe Sprite in the correct position.
  241. sprite_2 = Sprite.new
  242. sprite_2.x = x2
  243. sprite_2.y = y2
  244. sprite_2.z = 99999999
  245. # Sets Bitmap for the stripe, drawn from the correct screen position.
  246. rect_2 = Rect.new(x2, y2, stripe_width, stripe_height)
  247. sprite_2.bitmap = Bitmap.new(stripe_width, stripe_height)
  248. sprite_2.bitmap.blt(0, 0, @@_ms_split_transitions_screen, rect_2)
  249. # Time to make the stripes visible.
  250. Graphics.transition(0)
  251. # Moves until target position is reached.
  252. while (sprite_2.x <= tx && sprite_2.y <= ty)
  253. sprite_1.x -= plus_x
  254. sprite_2.x += plus_x
  255. sprite_1.y -= plus_y
  256. sprite_2.y += plus_y
  257. # Everyone wants to see the movement.
  258. Graphics.update
  259. end
  260. # Dispose Bitmaps and Sprites once they leave the screen.
  261. sprite_1.bitmap.dispose
  262. sprite_1.dispose
  263. sprite_2.bitmap.dispose
  264. sprite_2.dispose
  265. # Frees the screen container.
  266. @@_ms_split_transitions_screen.dispose
  267. @@_ms_split_transitions_screen = nil
  268. end
  269. # Records the current Scene name.
  270. @ms_split_transitions_origin_scene = SceneManager.scene.class.name
  271. # Original method.
  272. ms_split_transitions_original_post_start
  273. end
  274.  
  275. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement