Scratch game making tutorial 128

Jumping bean

In this tutorial you will make a game in which you must make a bean jump to earn reward points. We will make the game more challenging by having a hazard sprite that takes points away, and a 2 minute countdown timer.

 

Complete these steps ..

 

1. Create a new game then select the stage. Select the Backgrounds tab and then use the paint-bucket tool to paint the stage yellow ..

When you are finished click "OK".

 

 

2. Select the Scripts tab and add these scripts to the stage to begin and end the game ..

 

 

3. Select the Cat and re-name it "Cat" or another name of your choice.

 

 

4. Click the only-face-left-right button ..

 

 

5. Add the first script to the Cat to set it's size and starting position on the stage ..

 

 

6. Now add the script to make the Cat follow the mouse-pointer ..

 

Press the "B" key on your keyboard and then move your mouse-pointer on the stage to test your game.

 

 

7. Press "E" to end your game and then use File>Save as to save your game. Name it "Jumping bean".

 

 

8. Let's create the jumping bean sprite. Click the "paint new sprite" button under the stage ..

Select a dark red colour, then select the brush tool and the 2nd largest brush size. Now paint a bean like this ..

Click "OK" when you are finished.

 

 

9. Now re-name the sprite "Bean" or "Jumping bean" and add the first script ..

 

 

10. We want the bean to jump around the stage when the Cat touches it. Add this script to the bean ..

 

Press the "B" key on your keyboard and then move your mouse-pointer on the stage to test your game. Make the Cat touch the bean.

 

 

11. Press "E" to end your game and then use File>Save to re-save your game.

 

 

12. Next we need some reward sprites. When the Bean touches them they will add points. Click the "paint new sprite" button under the stage ..

Now Select the paint brush tool and the biggest brush size, and a bright colour and click once to paint a ball ..

Click "OK" when you are finished and then re-name the sprite "Reward 1".

 

 

12. It will be good if the Reward sprites come and go on the stage, appearing at random locations and times.

Add this script to Reward 1 ..

 

Press the "B" key on your keyboard and watch as the Reward appears around the stage.

 

 

13. Press "E" to end your game and then use File>Save to re-save your game.

 

 

14. Let's add a scoring system to our game. Select variables and then click the "Create new variable" button.

Name your variable "Score" and select "For all sprites".

 

 

15. Make sure the "Reward 1" sprite is selected and add this script to it ..

Press the "B" key on your keyboard and test your game. Make sure the score goes up when the Bean touches the Reward.

 

 

16. Press "E" to end your game and then right-click the Reward sprite thumbnail under the stage and create 3 duplicates so you have 4 reward sprites.

Make sure they are named , Reward 1, Reward 2, Reward 3, and Hazard ..

 

 

17. Select the Hazard sprite.

A hazard is something that creates a danger, and we are going to make this one take points away. Select it's script tab and change the score script from "1" to "-1" so that every time it touches the Bean a point is lost ..

 

 

18. As a final touch we are going to make a countdown timer.

Select the stage and then select the Variable scripts. Make a new variable "for all sprites" called "Countdown". Drag it to the top right corner of the stage ..

 

Now add this script to the stage ..

This script gives the player 120 seconds (2 minutes) to get as many points as possible.

 

 

19. Use "File>Save" to re-save your game and then press "B" to test it. How many points can you get in 120 seconds?

 

 

20. Well done. You have finished this tutorial. Can you add things to make the game better?