#---------------------------------------------------------------------------- # ○ Scrolling Map Script # ○ Authors: ViperX420 and Venka # ○ plug and play access just paste this script under materials. #---------------------------------------------------------------------------- # # Add Event(Scrolling_Map) Script Here # Refer to event on top left corner as reference for script. #----------------------------------------------------------------------------class Scene_Map < Scene_Base #---------------------------------------------------------------------------- # ○ new method: refresh_map(speed) speed = scrolling speed (0-9) #---------------------------------------------------------------------------- def refresh_map(speed = 0) # Instantly Centers Screen return $game_player.center($game_player.x, $game_player.y) if speed <= 0 loop do map_updates refresh_map_position(speed) break if @map_y == $game_map.display_y && @map_x = $game_map.display_y end end #-------------------------------------------------------------------------- # ○ new method: refresh_map_position(speed) speed = scrolling speed (0-9) #-------------------------------------------------------------------------- def refresh_map_position(speed) playerx = $game_player.x - $game_player.center_x ; playery = $game_player.y - $game_player.center_y return $game_map.start_scroll(2, playery - $game_map.display_y, speed) if playery > $game_map.display_y return $game_map.start_scroll(4, $game_map.display_x - playerx , speed) if playerx < $game_map.display_x return $game_map.start_scroll(6, playerx - $game_map.display_x , speed) if playerx > $game_map.display_x return $game_map.start_scroll(8, $game_map.display_y - playery, speed) if playery < $game_map.display_y end #-------------------------------------------------------------------------- # ● alias method: update #-------------------------------------------------------------------------- alias viperx_scrolling_map_update update def update viperx_scrolling_map_update start_map_interface if Input.trigger?Y) end #-------------------------------------------------------------------------- # ○ new method: map_updates #-------------------------------------------------------------------------- def map_updates Graphics.update Input.update $game_map.update @spriteset.update end #-------------------------------------------------------------------------- # ○ new method: start_map_interface #-------------------------------------------------------------------------- def start_map_interface create_map_arrows # Create the arrows image @map_y = $game_map.display_y; @map_x = $game_map.display_y loop do map_updates scroll_map(2, "SMA002") if Input.press?DOWN) scroll_map(4, "SMA003") if Input.press?LEFT) scroll_map(6, "SMA004") if Input.press?RIGHT) scroll_map(8, "SMA005") if Input.press?UP) if Input.trigger?Y) dispose_arrows if @arrows refresh_map(7) break end end end #-------------------------------------------------------------------------- # ○ new method: create_map_arrows #-------------------------------------------------------------------------- def create_map_arrows @arrows ? @arrows.visible = true : @arrows = Sprite.new(@viewport) @arrows.bitmap = Cache.picture("SMA001") end #-------------------------------------------------------------------------- # ○ new method: scroll_map #-------------------------------------------------------------------------- def scroll_map(direction, filename) @arrows.bitmap = Cache.picture(filename) # Change image shown $game_map.start_scroll(direction, 1, 6) # start scrolling map end #-------------------------------------------------------------------------- # ○ new method: dispose_arrows #-------------------------------------------------------------------------- def dispose_arrows @arrows.bitmap.dispose @arrows.dispose @arrows = nil endend