Wake the guard
ChallengeThings that happen
This guard has the right steps, but they happen at the wrong times. Your job is to fix it.
What should happen
When the script is right, the game goes like this.
- The game starts. The guard stands still.
- The hero walks toward the guard. The guard sees him, shouts "Who goes there?" and jumps.
- The hero swings his sword at the guard. The guard yelps "Ouch!"
What happens now
The two events are the wrong way round.
| When this happens | The guard does this | It should do this |
|---|---|---|
| The guard sees the hero | Yelps "Ouch!" | Shout "Who goes there?" and jump |
| The hero swings at it | Shouts "Who goes there?" and jumps | Yelp "Ouch!" |
How to fix it
You change a when line by picking a new one from a list.
- Look at the top left of the code box. Press Code
, if it is not picked already. - Find the when line above say "Who goes there?". It says
when the {Hero} swings at me. - Click the small arrow at the end of that line. A list of events drops down.
- In the list, click when I see the {Hero} within 5 blocks. The line changes.
- Now find the when line above say "Ouch!". It says
when I see the {Hero}. - Click the small arrow at the end of that line.
- In the list, click when the {Hero} swings at me.
Leave the last line, trigger "ouch", alone. It tells the goals that the guard yelped.
Test it
The goals show under the little game. They are checked when the guard is beaten.
- Press Play
. - Click the little game, so the arrow keys work.
- Hold the right arrow key to walk the hero toward the guard. The guard should shout and jump.
- Keep walking until the hero is about one block from the guard.
- Press the X key to swing the sword. The guard should yelp, and then it is beaten.
Both goals should now have a tick. If one has a cross, press Stop
, check your two when lines, and try again.

