Two things at once

Try itThings that happen

One script can wait for more than one event. Each event gets a rule of its own.

​
​

Three rules

This script has three rules. A blank line sits between them, to keep them easy to read.

RuleIts eventWhat the guard does
1The game startsStands still.
2The guard sees the heroShouts and jumps.
3The hero swings at the guardYelps.

Set off both events

  1. Press Play Play this script.
  2. Walk the hero toward the guard. Rule 2 runs.
  3. Stop about two blocks away and press X to swing. Rule 3 runs.

The order does not matter here

In the last chapter, the order of the steps mattered. The order of the rules does not. The guard is waiting for all its events at once. Whichever happens first, its rule runs first.

Inside a rule, the steps still go from the top down.

This section ticks itself when you press Play Play this script.

Press Play in the code box to finish this section.