Scratch game making tutorial 132b

Dodge ball - intermediate

In this tutorial you will create a game in which a cat must dodge balls to survive.

 

Complete these steps ..

 

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

 

 

2. Select the stage by clicking on the Stage thumbnail under the stage.

Add these scripts to the stage ..

Look at the scripts. As well as using the green flag we can also use the "B" key on our keyboard to BEGIN the game, and the "E" key to END it.

 

3. Now select the background tab and click the "Edit" button ..

 

Use the paint bucket tool to fill the stage with black and then click "OK' when you are done ..

 

 

4. Click the cat sprite thumbnail under the stage to select the Cat (sprite1) ..

 

 

5. Click in the naming box to re-name "sprite 1" "Cat".

Now click the middle of the 3 vertical buttons to make sure the Cat cannot turn upside down. When you hover the mouse over the button you will see it is called "only face left right".

 

 

6. Now add the following script to the Cat ..

Press "B" on your keyboard and you will see the cat shrink and move to the centre of the stage.

 

 

7. Now add the next script to the cat to make it follow the mouse pointer ..

 

When you are done test your game. Press the "b" key on your keyboard to begin your game, and then move the mouse-pointer around the stage. The Cat should follow it. Press "e" for end when you are ready to continue making your game.

 

 

8. Use "File>Save as" to save your game. Call it "Dodge ball"..

 

 

9. We are going to give our Cat 9 lives. When a ball hits the cat it will lose a life.

Select the Variables scripts and then click on "Make a variable" ..

 

Type "Lives" and then click "OK" ..

 

 

10. Add the following script to the Cat ..

 

 

11. Use File>Save to re-save your game.

 

 

12. Click the "Paint new sprite" button under the stage ..

 

Select the paint brush tool, then the largest brush size and then a red colour and click once to paint a single ball ..

 

Click "OK" when you are done.

 

 

13. Re-name the ball "Ball 1", and then add this script to shrink it down and hide it ..

 

 

14. Add the next Ball script. This script makes the ball bounce around the stage.

Notice that the speed of the ball is at 5 ("move 5 steps").

 

 

15. Press the "B" key to test your game. After a few seconds the ball should appear and bounce around the stage. Make the Cat run away and avoid it.

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

 

 

16. Use File>Save to re-save your game.

 

 

17. When the ball hits the Cat, the Cat will lose a life. Add this script ..

 

 

18. Press "B" to test your game. The Cat should lose a life when the ball touches it.

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

 

 

19. One ball is not enough. Right-click the "Ball 1" thumbnail under the stage to duplicate it ..

 

Now you have 2 balls. Select the new copy, and then select it's Costumes tab. Now click the "Edit" button and use the paint bucket tool to change the colour of the ball ..

 

Click "OK" when you are done. You can re-name the second ball if you like.

 

 

20. Make another 3 duplicate so you have 5 balls and change their colours too if you like ..

Press "B" to test your game. The game should be harder now.

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

 

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

 

 

22. Let's make the game even harder. Create at least 5 backgrounds, some which have colours on them which are the same colours as the balls. This will make it harder to see the balls. For example ..

 

 

23. Now add this script to the stage to make the backgrounds change ..

 

 

24. Press "B" to test your game. The game should be much harder now.

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

 

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

You've finished this tutorial. Well done!

 

 

22. Can you add the following mods? ..