Angrier each time

ChallengeStart your game

This slime should lose its temper. But however many times you hit it, it stays calm. Your job is to find the number that is wrong.

What should happen

When the script is right, the game goes like this.

  1. The game starts. The slime stands still.
  2. The hero hits the slime. It says "That is 1!" and stays calm.
  3. The hero hits it again. It says "That is 2!" Now it is angry: it speeds up and chases the hero.

What happens now

The slime counts its hits, but it never gets angry.

Look at the line if @hits is over 5. The slime only takes 5 hits, so @hits can never be over 5. The answer is always no.

How to fix it

The slime must get angry on its second hit. So the question should be: is @hits over 1?

  1. Look at the top left of the code box. Press Blocks Blocks.
  2. Find the if block. It says @hits is over 5.
  3. Click the number 5, in its white bubble. Type 1.
​
if
end

Goals0 of 2 passed

  • The slime has counted 2 hits: not checked yet
  • The slime is fast after 2 hits: not checked yet

Press Play and make every goal pass. A goal is checked when its moment in the game comes.

Test it

  1. Press Play Play this script, under the little game.
  2. Click the little game, so the keys work.
  3. Hold the right arrow key to walk the hero up to the slime. Stop about one block away.
  4. Press the X key to swing the sword. Then press it again.

The goals are checked just after the second hit.

If this happensWhat to change
The slime is fast after 2 hits has a crossThe number is still too big. It must be 1.
No goal is checkedThe slime must be hit twice. If it chases you after one hit, the number is too small.

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