RMVX ACE: HOW TO PAN SCREEN BACK TO ORIGIN?

Posts

Pages: 1
Dyluck
For thousands of years, I laid dormant. Who has disturbed my slumber?
5184
After you make the camera scroll away from your character, how do you make it automatically centre back on to your character like "pan screen to origin" in RM2K3?
Use a script call with this.

player = $game_player
player.center(player.x, player.y)
Dyluck
For thousands of years, I laid dormant. Who has disturbed my slumber?
5184
Is there a way to do it by actually scrolling back instead of "instantaneously" like that script?
I think this may be able to do it.

#==============================================================================
# ** 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
  #--------------------------------------------------------------------------
  # * Pan Screen to Origin
  #     speed : scrolling speed
  #--------------------------------------------------------------------------
  def pan_screen_to_origin(speed = 2)
    2.times {
      # Scroll to Screen Center
      scroll_to_screen_center(speed)
      # Wait While Scrolling
      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 to the Right
    if px > $game_map.display_x
      # Scroll Right
      $game_map.start_scroll(6, px - $game_map.display_x , speed)            
    end
    # If Screen Center is to the Left
    if px < $game_map.display_x
      # Scroll Right
      $game_map.start_scroll(4, $game_map.display_x - px , speed)            
    end    
    # If Screen Center is up
    if py < $game_map.display_y
      # Scroll Up
      $game_map.start_scroll(8, $game_map.display_y - py, speed)      
    end
    # If Screen Center is Down
    if py > $game_map.display_y
      # Scroll Down
      $game_map.start_scroll(2, py - $game_map.display_y, speed)
    end    
  end
end

Use this in a script call and it should center the screen.

pan_screen_to_origin

Or

pan_screen_to_origin(speed)
# Speed = Scroll Speed
# pan_screen_to_origin(6)

Let me know if it works.
Pages: 1