The family

ChallengeYour own words

This challenge checks that your game has a real family: enemies that share one script.

It is in your own game. Your game checks it with a third test.

What should happen

  1. Your game has a family called Dancers.
  2. Level 2 has two or more enemies in that family.
  3. They all dance the same way, because they all run the family's script.
  4. When the alarm goes off, your new test counts the Dancers in the level and passes.

What to check first

CheckHow
The family is called DancersGame Settings Game settings, then Scripts, then Families Families. The name is at the top.
Level 2 has two Dancers or moreClick each enemy, open Character scripting Character scripting, and look at the Family list.
They have no script of their ownTheir own script should be empty.

How to add the test

  1. Press Open your game here, in the builder below.
  2. Press the Game button Game settings, under the map. In Game Settings, find Scripts and press Tests Tests.
  3. Press Code Code. Under your two old tests, leave a blank line, then type these two lines.
when "alarm"
  test "Level 2 has a family of Dancers" if the remaining {Dancers} is at least 2
  1. Press Save Save.

The words the remaining {Dancers} count the Dancers still standing in the level. So this test asks: are there at least 2?

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

Test it

  1. In the builder, go to level 2 and press Play Play game, under the map.
  2. Leave the Dancers alone. Do not beat them before the alarm.
  3. Walk the hero onto the alarm block. The door opens, and your new test runs.
  4. Walk through and touch the goal.
  5. Look at the Test results drawer. All three tests should have a tick.
  6. Look under the builder. It should say that your tests passed.
If this happensWhat to do
The new test has a crossCount your Dancers in level 2. The family's name must be Dancers, the same as in the test.
A Dancer does not danceIt still has a script of its own. Open it and take it out.
An old test has no tickAll three must pass in the same go. Trip the alarm, then touch the goal.

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