class Game_Character #-------------------------------------------------------------------------- # * Turn Character at direction #-------------------------------------------------------------------------- def turn_at(turnat) case turnat when 2 self.turn_down when 8 self.turn_up when 4 self.turn_left when 6 self.turn_right end end end class Scene_Map #-------------------------------------------------------------------------- # * Player Place Move #-------------------------------------------------------------------------- def transfer_player #Save the Event Positions self.save_events # Clear player place move call flag $game_temp.player_transferring = false # If move destination is different than current map if $game_map.map_id != $game_temp.player_new_map_id # Set up a new map $game_map.setup($game_temp.player_new_map_id) end # Set up player position $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y) # Set player direction case $game_temp.player_new_direction when 2 # down $game_player.turn_down when 4 # left $game_player.turn_left when 6 # right $game_player.turn_right when 8 # up $game_player.turn_up end # Straighten player position $game_player.straighten # Update map (run parallel process event) $game_map.update # Remake sprite set @spriteset.dispose #Load the Event-positions self.load_events @spriteset = Spriteset_Map.new # If processing transition if $game_temp.transition_processing # Clear transition processing flag $game_temp.transition_processing = false # Execute transition Graphics.transition(20) end # Run automatic change for BGM and BGS set on the map $game_map.autoplay # Frame reset Graphics.frame_reset # Update input information Input.update end #-------------------------------------------------------------------------- # * Save the Event-positions from this map #-------------------------------------------------------------------------- def save_events() i = 1 x = $game_map.events[i].x y = $game_map.events[i].y r = $game_map.events[i].direction map = $game_map.map_id if $game_map.events[i] and @save_event_xy == nil @save_event_xy = {map => {i => {"x" => x, "y" => y, "r" => r}}} i += 1 elsif $game_map.events[i] and @save_event_xy[map] == nil @save_event_xy.update({map => {i => {"x" => x, "y" => y, "r" => r}}}) i += 1 end while($game_map.events[i]) x = $game_map.events[i].x y = $game_map.events[i].y r = $game_map.events[i].direction @save_event_xy[map].update({i => {"x" => x, "y" => y, "r" => r}}) i += 1 end end #-------------------------------------------------------------------------- # * Loade the Event-position from this map #-------------------------------------------------------------------------- def load_events() i = 1 map = $game_map.map_id evts = @save_event_xy[map] while evts and evts[i] and $game_map.events[i] x = evts[i]["x"] y = evts[i]["y"] r = evts[i]["r"] $game_map.events[i].moveto(x, y) $game_map.events[i].turn_at(r) i += 1 end end end