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.

 

NOTE: You can use any version of Scratch.

 

Complete these steps ..

 

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

 

 

2. Select the stage then select the Backdrops/Backgrounds tab and then use the fill/paint-bucket tool to paint the stage yellow.

If you are using Scratch Desktop click this button first ..

 

 

3. Select the stages Code/Scripts tab and add this code/scripts to the stage to begin and end the game ..

 

 

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

Click the "only face left right" button ..

If you are using Scratch desktop add this code ..

 

 

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

 

 

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

 

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 "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 code/script ..

 

 

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

Add this code/script to the bean ..

 

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 save your game.

 

 

12. Next we need some reward sprites. When the Bean touches them they will add points.

Paint a new sprite with the paint brush tool ..

 

If you are using Scratch Desktop you may find it easier to use Bitmap mode so click this button ..

 

You need to paint a big coloured ball ..

 

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 code/script to Reward 1 ..

 

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.

 

 

13. Use the File menu to 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 code/script to it ..

 

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

Make sure the score goes up when the Bean touches the Reward.

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

 

 

16. 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 code/script tab and change the score code/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 code/script to the stage ..

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

 

Press the "B" key on your keyboard to test your game. How many points can you get in 120 seconds?

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

 

 

19. Use the File menu to save your game.

 

 

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