#============================================================================== # ** TDS Scroll Screen to Origin # Ver: 1.0 #------------------------------------------------------------------------------ # * Description: # This script allows you to scroll or instantly set the center of the screen # to match the position of the player. #------------------------------------------------------------------------------ # * Features: # Scrolls to the center of the screen. # Set the center position instantly. #------------------------------------------------------------------------------ # * Instructions: # To scroll back to the center position of the screen, use this in a script # call: # # scroll_screen_to_origin(speed) # # speed = Scrolling speed. (From 0 to 9) (0 Will set it instantly) # # Example: # # scroll_screen_to_origin(7) #------------------------------------------------------------------------------ # * Notes: # None. #------------------------------------------------------------------------------ # WARNING: # # Do not release, distribute or change my work without my expressed written # consent, doing so violates the terms of use of this work. # # If you really want to share my work please just post a link to the original # site. # # * Not Knowing English or understanding these terms will not excuse you in any # way from the consequenses. #============================================================================== # * Import to Global Hash * #============================================================================== ($imported ||= {})[:TDS_Scroll_Screen_To_Origin] = true #============================================================================== # ** Game_Interpreter #------------------------------------------------------------------------------ # An interpreter for executing event commands. This class is used within the # Game_Map, Game_Troop, and Game_Event classes. #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # * Scroll Screen to Origin # speed : scrolling speed (1 ~ 9) (10 and up seems buggy) (0 is isntant) #-------------------------------------------------------------------------- def scroll_screen_to_origin(speed = 2) # Instantly Center Screen if speed is 0 or less return $game_player.center($game_player.x, $game_player.y) if speed <= 0 # Scroll to Screen Center 2.times { scroll_to_screen_center(speed) ; wait(1) while $game_map.scrolling? } end #-------------------------------------------------------------------------- # * Scroll to Screen Center # speed : scrolling speed #-------------------------------------------------------------------------- def scroll_to_screen_center(speed) # Get Player Center Positions px = $game_player.x - $game_player.center_x ; py = $game_player.y - $game_player.center_y # If Screen Center is Down return $game_map.start_scroll(2, py - $game_map.display_y, speed) if py > $game_map.display_y # If Screen Center is to the Left return $game_map.start_scroll(4, $game_map.display_x - px , speed) if px < $game_map.display_x # If Screen Center is to the Right return $game_map.start_scroll(6, px - $game_map.display_x , speed) if px > $game_map.display_x # If Screen Center is up return $game_map.start_scroll(8, $game_map.display_y - py, speed) if py < $game_map.display_y end end