Advertisement
Guest User

Untitled

a guest
May 24th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.82 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Parallax Lock v1.00
  4. # -- Last Updated: 2012.02.19
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10.  
  11. $imported = {} if $imported.nil?
  12. $imported["YEA-ParallaxLock"] = true
  13.  
  14.  
  15. #==============================================================================
  16. # ▼ Updates
  17. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  18. # 2012.02.19 - Started Script and Finished.
  19. #
  20. #==============================================================================
  21. # ▼ Introduction
  22. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  23. # This script gives developers the ability to lock a map's parallax and cause
  24. # it to not scroll by either vertically, horizontally, or both. Furthermore,
  25. # this script also enables tile locking the map parallax, allowing the parallax
  26. # to only move in conjunction with the player.
  27. #
  28. #==============================================================================
  29. # ▼ Instructions
  30. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  31. # To install this script, open up your script editor and copy/paste this script
  32. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  33. #
  34. # -----------------------------------------------------------------------------
  35. # Map Notetags - These notetags go in the map notebox in a map's properties.
  36. # -----------------------------------------------------------------------------
  37. # <lock parallax x>
  38. # This prevents the map's parallax from scrolling horizontally.
  39. #
  40. # <lock parallax y>
  41. # This prevents the map's parallax from scrolling vertically.
  42. #
  43. # <full lock parallax>
  44. # This prevents the map's parallax from scrolling at all.
  45. #
  46. # <tile lock parallax>
  47. # This causes the map's parallax to be locked to tiles and scrolls with them.
  48. #
  49. #==============================================================================
  50. # ▼ Compatibility
  51. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  52. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  53. # it will run with RPG Maker VX without adjusting.
  54. #
  55. #==============================================================================
  56. # ▼ Editting anything past this point may potentially result in causing
  57. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  58. # halitosis so edit at your own risk.
  59. #==============================================================================
  60.  
  61.  
  62. module YEA
  63. module REGEXP
  64. module MAP
  65.  
  66. LOCK_PARALLAX_X = /<(?:LOCK_PARALLAX_X|lock parallax x)>/i
  67. LOCK_PARALLAX_Y = /<(?:LOCK_PARALLAX_Y|lock parallax y)>/i
  68. FULL_LOCK_PARALLAX = /<(?:FULL_LOCK_PARALLAX|full lock parallax)>/i
  69. TILE_LOCK_PARALLAX = /<(?:TILE_LOCK_PARALLAX|tile lock parallax)>/i
  70.  
  71. end # MAP
  72. end # REGEXP
  73. end # YEA
  74.  
  75.  
  76. #==============================================================================
  77. # ■ RPG::Map
  78. #==============================================================================
  79.  
  80.  
  81. class RPG::Map
  82.  
  83. #--------------------------------------------------------------------------
  84. # public instance variables
  85. #--------------------------------------------------------------------------
  86. attr_accessor :parallax_lock_x
  87. attr_accessor :parallax_lock_y
  88. attr_accessor :parallax_tile_lock
  89.  
  90. #--------------------------------------------------------------------------
  91. # common cache: load_notetags_paralock
  92. #--------------------------------------------------------------------------
  93. def load_notetags_paralock
  94. @parallax_lock_x = false
  95. @parallax_lock_y = false
  96. @parallax_tile_lock = false
  97. #---
  98. self.note.split(/[\r\n]+/).each { |line|
  99. case line
  100. #---
  101. when YEA::REGEXP::MAP::LOCK_PARALLAX_X
  102. @parallax_lock_x = true
  103. @parallax_tile_lock = false
  104. when YEA::REGEXP::MAP::LOCK_PARALLAX_Y
  105. @parallax_lock_y = true
  106. @parallax_tile_lock = false
  107. when YEA::REGEXP::MAP::FULL_LOCK_PARALLAX
  108. @parallax_lock_x = true
  109. @parallax_lock_y = true
  110. @parallax_tile_lock = false
  111. when YEA::REGEXP::MAP::TILE_LOCK_PARALLAX
  112. @parallax_lock_x = false
  113. @parallax_lock_y = false
  114. @parallax_tile_lock = true
  115. #---
  116. end
  117. } # self.note.split
  118. #---
  119. end
  120.  
  121. end # RPG::Map
  122.  
  123.  
  124. #==============================================================================
  125. # ■ Game_Map
  126. #==============================================================================
  127.  
  128.  
  129. class Game_Map
  130.  
  131. #--------------------------------------------------------------------------
  132. # alias method: setup
  133. #--------------------------------------------------------------------------
  134. alias game_map_setup_parallax_paralock setup_parallax
  135. def setup_parallax
  136. @map.load_notetags_paralock
  137. game_map_setup_parallax_paralock
  138. end
  139.  
  140. #--------------------------------------------------------------------------
  141. # new method: parallax_lock_x?
  142. #--------------------------------------------------------------------------
  143. def parallax_lock_x?
  144. return @map.parallax_lock_x
  145. end
  146.  
  147. #--------------------------------------------------------------------------
  148. # new method: parallax_lock_y?
  149. #--------------------------------------------------------------------------
  150. def parallax_lock_y?
  151. return @map.parallax_lock_y
  152. end
  153.  
  154. #--------------------------------------------------------------------------
  155. # new method: parallax_tile_lock?
  156. #--------------------------------------------------------------------------
  157. def parallax_tile_lock?
  158. return @map.parallax_tile_lock
  159. end
  160.  
  161. #--------------------------------------------------------------------------
  162. # alias method: parallax_ox
  163. #--------------------------------------------------------------------------
  164. alias game_map_parallax_ox_paralock parallax_ox
  165. def parallax_ox(bitmap)
  166. return 0 if parallax_lock_x?
  167. return @display_x * 32 if parallax_tile_lock?
  168. return game_map_parallax_ox_paralock(bitmap)
  169. end
  170.  
  171. #--------------------------------------------------------------------------
  172. # alias method: parallax_oy
  173. #--------------------------------------------------------------------------
  174. alias game_map_parallax_oy_paralock parallax_oy
  175. def parallax_oy(bitmap)
  176. return 0 if parallax_lock_y?
  177. return @display_y * 32 if parallax_tile_lock?
  178. return game_map_parallax_oy_paralock(bitmap)
  179. end
  180.  
  181. end # Game_Map
  182.  
  183.  
  184. #==============================================================================
  185. #
  186. # ▼ End of File
  187. #
  188. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement