Copy Event Page and then Paste Event Page (for convenience’s sake).
First, we need to change the Trigger to Autorun and set the Condition to Self Switch A is ON. Delete the contents of the page.
We’re going to make a Conditional Branch to check whether the player is pressing the action key/C button (which is space/enter/Z on your keyboard). Now, we could just go Conditional Branch > Button > C is Being Pressed, but I prefer to use this little script instead:
This checks if the button has been tapped, rather than pushed and held. So, on tab 4 of the Conditional Branch window, select Script and type that in. Tick ‘Set handling when conditions do not apply’.
Inside our Conditional Branch, we want to make a short wait of 5 frames, and then turn Self Switch A, B and C OFF. We also want to change our Actor Graphic back to its usual graphic (or set the Player Stepping Anim OFF).
Now, inside our Else branch for that Conditional Branch, we want to make a set of Conditional Branches that check the direction the Player is facing, and then check which buttons are being pressed.
We will need one Conditional Branch per direction, with Else off, and then some Conditional Branches nested inside each other that check the
matching,
opposite and
other directions.
For example, if the Player was facing Down, we would check if the Down Button was being pressed, and then in the Else branch check if the Up Button was being pressed, and then in
that Else branch we would check whether the Left OR Right Buttons were being pressed.
The easiest way to check multiple directions at once is to use the following script call in a Conditional Branch:
Code:
Input.press?(:LEFT) || Input.press?(:RIGHT)
The || means OR in Ruby. To check Up or Down, you would replace the words inside the parentheses with
:UP and
OWN . You could also use two more Conditional Branches nested inside each other, but this seemed tidier and kills two birds with one stone.
Inside our
matching direction Conditional Branch, we want to set the Self Switch B to ON. This is going to be our ‘pushing’ page (but more on that later).
Inside our
opposite direction Conditional Branch, we want to set Self Switch C to ON—this will be our ‘pulling’ page.
In the
other directions Conditional Branch, we want to do the same as the first Conditional Branch for pressing the action key (wait 5 frames, turn Self Switch A, B and C OFF, and change our Actor Graphic to its usual graphic/set the Player Stepping Anim OFF).
Do this for each direction. I also put a comment at the top of each Conditional Branch saying what direction it’s for, just to remind myself.
Code:
Page 2:
CONDITION: Self Switch A =ON
OPTIONS: Walking Anim ON, Direction Fix ON
TRIGGER: Autorun
SPEED: 2: 4x slower
FREQ: 3: Normal
@> Conditional Branch: Script: Input.trigger?(:C)
@> Wait: 5 frames
@> Control Self Switch: A =OFF
@> Control Self Switch: B =OFF
@> Control Self Switch: C =OFF
@> Change Actor Graphic: [normal] |OR| Set Move Route: Player (Wait) Stepping Anim OFF
@>
: Else
@> Conditional Branch: Player is Facing Down
@> Conditional Branch: The Down Button is Being Pressed
@> Control Self Switch: B =ON
: Else
@> Conditional Branch: The Up Button is Being Pressed
@> Control Self Switch: C =ON
: Else
@> Conditional Branch: Script: Input.press?(:LEFT) ||
Input.press?(:RIGHT)
@> Wait: 5 frames
@> Control Self Switch: A =OFF
@> Control Self Switch: B =OFF
@> Control Self Switch: C =OFF
@> Change Actor Graphic: [normal] |OR| Set Move Route: Player (Wait) Stepping Anim OFF
@>
Branch End
@>
Branch End
@>
Branch End
@>
Branch End
@> Conditional Branch: Player is Facing Left
@> Conditional Branch: The Left Button is Being Pressed
@> Control Self Switch: B =ON
: Else
@> Conditional Branch: The Right Button is Being Pressed
@> Control Self Switch: C =ON
: Else
@> Conditional Branch: Script: Input.press?(:UP) || Input.press?(:DOWN)
@> Wait: 5 frames
@> Control Self Switch: A =OFF
@> Control Self Switch: B =OFF
@> Control Self Switch: C =OFF
@> Change Actor Graphic: [normal] |OR| Set Move Route: Player (Wait) Stepping Anim OFF
@>
Branch End
@>
Branch End
@>
Branch End
@>
Branch End
@> Conditional Branch: Player is Facing Right
@> Conditional Branch: The Right Button is Being Pressed
@> Control Self Switch: B =ON
: Else
@> Conditional Branch: The Left Button is Being Pressed
@> Control Self Switch: C =ON
: Else
@> Conditional Branch: Script: Input.press?(:UP) || Input.press?(:DOWN)
@> Wait: 5 frames
@> Control Self Switch: A =OFF
@> Control Self Switch: B =OFF
@> Control Self Switch: C =OFF
@> Change Actor Graphic: [normal] |OR| Set Move Route: Player (Wait) Stepping Anim OFF
@>
Branch End
@>
Branch End
@>
Branch End
@>
Branch End
@> Conditional Branch: Player is Facing Up
@> Conditional Branch: The Up Button is Being Pressed
@> Control Self Switch: B =ON
: Else
@> Conditional Branch: The Down Button is Being Pressed
@> Control Self Switch: C =ON
: Else
@> Conditional Branch: Script: Input.press?(:LEFT) || Input.press?(:RIGHT)
@> Wait: 5 frames
@> Control Self Switch: A =OFF
@> Control Self Switch: B =OFF
@> Control Self Switch: C =OFF
@> Change Actor Graphic: [normal] |OR| Set Move Route: Player (Wait) Stepping Anim OFF
@>
Branch End
@>
Branch End
@>
Branch End
@>
Branch End