Created
August 2, 2016 19:22
-
-
Save HimeWorks/14c27a6ee4243a3296a3e28c2c403cd0 to your computer and use it in GitHub Desktop.
[Ace] Scrolling Parallax Speed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script that allows you to specify custom scroll speeds for parallax scrolling. | |
# Note-tag maps with: | |
# | |
# <horz scroll: VALUE /> | |
# <vert scroll: VALUE /> | |
# | |
# The VALUE is a number that determines how fast it scrolls. | |
# | |
# You can specify positive or negative numbers depending on whether you want it to scroll left or right. | |
module TH | |
module Scrolling_Parallax_Speed | |
Horz_Regex = /<horz[-_ ]scroll:\s*(.+?)\s*\/>/i | |
Vert_Regex = /<vert[-_ ]scroll:\s*(.+?)\s*\/>/i | |
end | |
end | |
module RPG | |
class Map | |
alias :th_scrolling_parallax_speed_parallax_sx :parallax_sx | |
def parallax_sx | |
parse_notetag_scrolling_parallax unless @scrolling_parallax_notetag_loaded | |
th_scrolling_parallax_speed_parallax_sx | |
end | |
alias :th_scrolling_parallax_speed_parallax_sy :parallax_sy | |
def parallax_sy | |
parse_notetag_scrolling_parallax unless @scrolling_parallax_notetag_loaded | |
th_scrolling_parallax_speed_parallax_sy | |
end | |
def parse_notetag_scrolling_parallax | |
res = self.note.match(TH::Scrolling_Parallax_Speed::Horz_Regex) | |
if res | |
@parallax_sx = res[1].to_i | |
end | |
res = self.note.match(TH::Scrolling_Parallax_Speed::Vert_Regex) | |
if res | |
@parallax_sy = res[1].to_i | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment