Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # DRG - Diagonal Scroll
- # Version: 1.01
- # Author : LiTTleDRAgo
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- #
- # How to Use :
- #
- # Script : scroll_map(type, distance, speed)
- # type : direction (1,2,3,4,5,6,7,8,9)
- # dist : distance scrolling
- # speed : (1:slowest 2:slower 3:slow 4:fast 5: faster 6:fastest)
- #
- #==============================================================================
- ($imported ||= {})[:drg_diagonal_scroll] = 1.01
- #==============================================================================
- # ** Interpreter
- #------------------------------------------------------------------------------
- # This interpreter runs event commands. This class is used within the
- # Game_System class and the Game_Event class.
- #==============================================================================
- Klass = defined?(Window_ActorCommand) ? Game_Interpreter : Interpreter
- class Klass
- #--------------------------------------------------------------------------
- # scroll_map
- # type : (1,2,3,4,5,6,7,8,9)
- # dist : distance scrolling
- # speed : (1:slowest 2:slower 3:slow 4:fast 5: faster 6:fastest)
- #--------------------------------------------------------------------------
- def scroll_map(type, dist, speed)
- return true if $game_temp.instance_variable_get(:@in_battle)
- return true if $game_party.instance_variable_get(:@in_battle)
- return false if $game_map.scrolling?
- speed += 0.5 if type == 1 or type == 3 or type ==7 or type == 9
- $game_map.start_scroll(type, dist, speed)
- return true
- end
- end
- #==============================================================================
- # ** Game_Map
- #------------------------------------------------------------------------------
- # This class handles the map. It includes scrolling and passable determining
- # functions. Refer to "$game_map" for the instance of this class.
- #==============================================================================
- class Game_Map
- #--------------------------------------------------------------------------
- # * Alias Method
- #--------------------------------------------------------------------------
- @@scroll = method_defined?(:do_scroll) ? :do_scroll : :update
- alias_method :update_scrolling_straight, :"#{@@scroll}"
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- define_method(:"#{@@scroll}") do |*args|
- update_scrolling_diagonal
- update_scrolling_straight(*args)
- end
- #--------------------------------------------------------------------------
- # * Update Scrolling Diagonal
- #--------------------------------------------------------------------------
- def update_scrolling_diagonal
- if scrolling?
- distance = 2 ** @scroll_speed
- distance = scroll_distance if defined?(scroll_distance)
- case @scroll_direction
- when 1 then [scroll_down(distance), scroll_left(distance) ]
- when 3 then [scroll_down(distance), scroll_right(distance)]
- when 7 then [scroll_up(distance), scroll_left(distance) ]
- when 9 then [scroll_up(distance), scroll_right(distance)]
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement