h

Scratch games making tutorial 154

Clear the balls

In this tutorial you will create a game in which the player must make a red ball collide with green balls to clear them from the stage before the time runs out.

 

 

Complete these steps ..

 

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

 

 

2. Right-click on the Cat sprite under the stage to delete it.

 

 

3. Select the stage and click the Backgrounds tab, then click the Edit button to edit the stage background.

Select the Paint bucket tool and click to fill the background with black.

 

Next select the rectangle tool, a yellow colour, and draw a thin yellow box at the bottom center of the stage like this ..

 

Now click OK.

 

 

4. Switch to the stage's Scripts tab. You are going to create a simple countdown timer.

Select Variables, then click "Make a variable" and type "Timer", then click OK.

The Timer display should appear in the top right hand corner of the stage.

 

Now add the following script to the stage ..

 

Press the "B" key on your keyboard to test your game. The timer should count down to 0 and then stop.

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

 

 

5. Use "File>Save as" to name and save your game. Name it "Clear the balls" ..

 

 

6. You need a red ball for the player to control. Click the Paint new sprite button under the stage ..

 

Select red and then select the 4th largest brush size ..

 

Now click once in the paint area to create a single red ball ..

 

Click OK to finish.

 

 

7. Re-name the sprite "Red" ..

 

Switch to the Scripts tab and add the following scripts to the Red ball (you don't need to add the comments but you should read them to understand what the scripts do) ..

 

Press the "B" key on your keyboard to test your game. The Red ball sprite should follow your mouse-pointer around the stage.

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

 

 

8. Use "File>Save" to re-save your game ..

 

 

9. Create a Green ball sprite in exactly the way you just created the Red ball sprite. Name it "Green".

 

 

10. Now add the following script to the Green ball to position it somewhere random on the stage ..

 

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

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

 

 

11. Next add the following script to the Green ball to make it move away when touched by the Red ball ..

 

 

12. Add the final script to the Green ball to make it disappear when it touches the Yellow box (remember you must sample the colour yellow) ..

Press the "B" key on your keyboard to test your game. You should be able to clear the Green ball from the stage.

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

 

 

13. A single Green ball is not enough. Right-click on it and select duplicate to create 14 more green balls (you don't need to rename them) ..

Press the "B" key on your keyboard to test your game. Can you clear all the Green ball from the stage before the timer runs out?

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

 

 

14. Use "File>Save" to re-save your game ..

 

 

15. Well done, you've finished this tutorial. Can you improve the game by adding your own ideas?