The gauntlet
ChallengeDoing it again
A row of things to get past is called a gauntlet. Your game has one now. This challenge is to get your hero through it.
This challenge is in your own game, not in a code box. Your game checks it for you, with a test that you write.
What should happen
- Your level has a row of jumpers, and a goal after the last one.
- You press Play in the builder and run the hero through the row.
- The hero touches the goal. The game is won.
- Your test sees the win and passes. This section gets its tick.
What to build
- Press Open your game here, in the builder below.
- Press the Objects button
, on the left of the builder, and click Goal. - Click on your ground, a few blocks after the last jumper.
How to add the test
A test is a line of script that checks your game.
- Press the Game button
, under the map. It is the one with the gear. - In Game Settings, find Scripts and press Tests
. A script window opens. - Press Code
. Type these two lines, just as they are here.
when the game is won
test "The hero got past the jumpers" if the {Hero} health is over 0- Press Save
.
The first line waits for the game to be won. The second line is the test. It has a name in quotes, and a question after if.
Test it
- In the builder, press Play
, under the map. - Run the hero through the row. Jump over a jumper while it is on the ground, or run under it while it is in the air.
- Touch the goal.
- Look at the Test results drawer in the builder. Your test should have a tick.
- Look under the builder. It should say that your test passed.
| If this happens | What to do |
|---|---|
| The hero keeps getting hurt | Move the jumpers further apart, or make their wait longer. It is your game: you set how hard it is. |
| The test has no tick | The test only runs when the game is won. Make sure the hero touches the goal. |
| The Tests button is not there | Look in Game Settings |

