The shy ghost

ChallengeChanging how it looks

This slime is shy. It wants to hide when the hero is near. But its two numbers are the wrong way round. Your job is to fix them.

What should happen

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

  1. The game starts. The slime stands still. You can see it clearly.
  2. The hero walks toward the slime. The slime sees him and fades, so it is hard to see.
  3. The hero walks away again. The slime loses sight of him and comes back, as solid as before.

What happens now

The slime does the opposite. It stays solid when it sees the hero, and fades when he has gone.

How to fix it

Remember: an opacity of 100 is solid, and a small number is faded.

  1. Look at the top left of the code box. Press Blocks Blocks.
  2. Find the block under when I see the Hero. It says my opacity is 100.
  3. Click the number 100, in its white bubble. Type 20.
  4. Find the block under when I lose the Hero. It says my opacity is 20.
  5. Click the number 20. Type 100.
​
​

Goals0 of 2 passed

  • The ghost fades when it sees the hero: not checked yet
  • The ghost comes back when the hero has gone: 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 arrow keys work.
  3. Hold the right arrow key to walk the hero toward the slime. Stop a block or two away, and wait for 2 seconds. The first goal is checked.
  4. Hold the left arrow key to walk the hero back to where he began, and wait for 2 seconds. The second goal is checked.
If this goal has a crossWhat to change
The ghost fades when it sees the heroThe number under when I see the Hero must be under 50.
The ghost comes back when the hero has goneThe number under when I lose the Hero must be 100.

Press Stop Stop, change a number, and press Play again. Have as many goes as you like.

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