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

  1. Your level has a row of jumpers, and a goal after the last one.
  2. You press Play in the builder and run the hero through the row.
  3. The hero touches the goal. The game is won.
  4. Your test sees the win and passes. This section gets its tick.

What to build

  1. Press Open your game here, in the builder below.
  2. Press the Objects button Objects, on the left of the builder, and click Goal.
  3. 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.

  1. Press the Game button Game settings, under the map. It is the one with the gear.
  2. In Game Settings, find Scripts and press Tests Tests. A script window opens.
  3. Press Code 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
  1. Press Save 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.

This makes a new game in your Lab and opens the builder right here. It is free.

Test it

  1. In the builder, press Play Play game, under the map.
  2. 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.
  3. Touch the goal.
  4. Look at the Test results drawer in the builder. Your test should have a tick.
  5. Look under the builder. It should say that your test passed.
If this happensWhat to do
The hero keeps getting hurtMove the jumpers further apart, or make their wait longer. It is your game: you set how hard it is.
The test has no tickThe test only runs when the game is won. Make sure the hero touches the goal.
The Tests button is not thereLook in Game Settings Game settings, under Scripts.

Make every goal and every test pass to finish this section.