Scratch game making tutorial 192

Crystals and walls

In this game you will control the Cat sprite which must avoid the moving walls to collect the crystals. Every time it touches a wall it loves a life.

 

NOTE: You need to use Scratch Desktop (version 3 of Scratch) or higher.

 

Complete these steps ..

 

1. Open Scratch Desktop (v3), OR create a new game by choosing "File>New" from the top menu ..

 

 

2. Download, save and then open this game file ..

 

 

3. Select the stage, and add this code ..

 

Click on the Backdrops tab and you will see that there are 3 backdrop costumes. These backgrops will be used for playing, and when the game ends ..

 

 

Add the code to switch these backdrops ..

 

 

4. The game requires some variables. Create these variables ("For all sprites") ..

 

Arrange the visible variables on the stage like this ..

 

 

5. The player will control the Cat sprite. Select it and add its properties code ..

 

Next add the code to control its movement with the mouse-pointer and to make it run away if it touches a wall.

We have included an image so you can set the colour of the wall correctly in the "touching" code block ..

 

Press the "B" key on your keyboard to test your game.

When you are ready, press the "E" key to end your game and continue working on it.

 

 

6. Next add the code to set its Lives ..

 

Add the code for when "lose a life" is broadcast ..

 

Press the "B" key on your keyboard to test your game.

When you are ready, press the "E" key to end your game and continue working on it.

 

 

7. Use the File menu to save your game. Name it "Crystals and walls v1.sb3" ..

 

 

8. Select the Crystals sprite and add its properties code ..

 

We are going to put the number of Crystal clones into a variable so we can check that number has been collected by the Cat.

Doing this will also make it easier for you to change the number of Crystals created.

Add this code ..

 

When all the Crystals are collected we will broadcast "Success".

Add this code ..

 

Now add the code to animate the clones ..

 

Press the "B" key on your keyboard to test your game.

When you are ready, press the "E" key to end your game and continue working on it.

 

 

9. Use the File menu to re-save your game.

 

 

10. The Walls move across the stage, repelling the Cat and taking lives so must be avoided!

The speed and size of the Walls increases as the game progresses.

Select the Wall sprite and add the code to change its size and speed over time ..

 

Now add the code to clone it ..

Notice that there is a short 0.01sec wait. This ensures that the variables are set before the cloning code executes.

 

Now add the code to move the clones ..

 

Finally, add the code to resize the walls when the"Wall size" variable increases ..

 

Press the "B" key on your keyboard to test your game.

When you are ready, press the "E" key to end your game and continue working on it.

 

 

11. Use the File menu to re-save your game.

 

 

12. Well done, you've completed this game. Can you improve it with your own ideas?

 

Scratch cat and code blocks video screenshot Scratch coding online video courses

Our Scratch coding online video courses are an ideal way for your child to experience our lessons at home, if attending a course or club is inconvenient for you, or if you are waiting to attend a taster session, or an activity.
£24.99 or less