Challenge 2 – Hide and Seek

Video

The Challenge

Create a simple hide a seek game where scratch has to find another character on the screen!

Step 1 – Moving sprites to  a random location.

When we want to move sprites to a random location, we need to use the random block.

random

In order to move the sprites we should set their X and Y coordinates to numbers to numbers within the stage.

xy-grid

Can you work out what numbers to put in the scratch blocks below to make the code work?

random location

Step 2 – Move Scratch with the arrow keys

By now this should be easy for you!

Step 3 – Make the boy sprite hide at the start of the game and appear when the scratch finds him!

See if you can rearrange the code below and add it to the boy sprite to get him to appear when scratch is near him!

challenge 2 boy code

Question

Why do you think we have used :

distance to sprite 1

instead of:

touching sprite 1

Why will touching Sprite1 not work?