Push to Move
Version: 1.0
Type: Event Behavior
IntroductionThis is a fairly simple system, but some people might bother with more complicated ways to achieve this while it's actually so easy to make.
Features
- pressing in an event's direction will move the event
- additional conditional branch to prevent any movement if there's a wall
ScreenshotsN/A
DemoN/A
InstructionsPut this event code in any event.
@>Play SE: '045-Push01', 80, 100
@>Set Move Route: Player
: $>Change Speed: 3
@>Set Move Route: Player
: $>1 Step forward
@>Set Move Route: This event
: $>Turn away from Player
: $>1 Step forward
@>Wait: 8 frames
@>Set Move Route: Player
: $>Change Speed: 4
A possible improvement is to prevent moving at all if the event can't move. In this case you need a scripted Conditional branch wrapping the event code above. This is the altered event code:
@>Conditional Branch: Script: $game_map.events[@event_id].passable?($game_map.events[@event_id].x, $game_map.events[@event_id].y, $game_player.direction)
@>Play SE: '045-Push01', 80, 100
@>Set Move Route: Player
: $>Change Speed: 3
@>Set Move Route: Player
: $>1 Step forward
@>Set Move Route: This event
: $>Turn away from Player
: $>1 Step forward
@>Wait: 8 frames
@>Set Move Route: Player
: $>Change Speed: 4
: Branch End
If you don't use a speed change, be sure to set the "Wait" command appropriately to 1, 2, 4, 8, 16 or 32 for the player speeds 6, 5, 4, 3, 2 and 1 respectively. (i.e. the speed was changed to 3, to a time of 8 frames is required)
Credits and Thanks
Author's NotesYou can use this code in a common event and simply call that common event from an actual event.
N-Joy! =D