Scratch game making tutorial 105

Colour wheel

In this tutorial you will create a game with level 3/4 scripts in which the player must move a ball though a rotating colour wheel to gain rewards at the colour wheel's center.

The ball will only get through if it's colour matches the colour wheel segment it is passing through. The aim is to get as many points as possible.

 

Complete these steps ..

 

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

 

2. Click on the Cat thumbnail (sprite1) under the stage and right-click to delete it.

 

3. Select the stage and paint it black.

 

4. Add these scripts to the stage ..

 

5. Create these 3 variables "for all sprites" ..

Leave only "Rewards" visible on the stage, and right-click it on the stage to change it to "large readout" ..

 

6. Download, save and then import ("choose new sprite from file") these three sprites into your game

 

7. Add these scripts to the Colour wheel sprite ..

Notice how the turn speed of the sprite is controlled by a variable. We will increase this speed every time the players gets a reward in order to make the game more difficult.

 

8. Now test your game. Press the "b" key on your keyboard to begin your game, the Colour wheel should slowly rotate. Press "e" for end when you are ready to continue making your game.

 

9. Use "File>Save as" to save your game. Name it "Colour wheel"..

 

10. Select the Reward sprite. The player must touch this sprite with the ball to earn reward points. The closer the ball is to the sprite the faster it will turn. When it is touched it will flash (change costumes).

Add these scripts to it ..

Notice how we position it by making it go to the colour wheel. It will receive the broadcast "flash reward" when the ball touches it.

 

11. Now select the Ball sprite. Switch to the costume tab and you'll see their are four different coloured costumes and three exploding costumes ..

The exploding costumes are used when the ball hits the wrong colour wheel colour segment. Notice that the three exploding costume numbers are 5, 6 and 7.

 

12. Most of the game's scripts are on the ball sprite.

Start by adding this script ..

Notice how when the game begins the Ball's costume is randomly selected from 1, 2, 3 or 4 (red, green, blue or yellow).

 

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

 

14. Add this next script to the ball ..

NOTE: You don't need to add the comments, but take a moment to read them to understand what the various bits of the script do.

The "set Reward spin speed" script block makes the reward spin faster as the ball gets closer to it.

 

15. Test your game by pressing "B" to begin your game. Use the Up arrow key on your keyboard to move your ball towards the Reward sprite. Remember you can END the game by pressing the "e" key.

 

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

 

17. Now we need to add the script that determines what happens to the ball when it touches the Reward sprite or the different colours segments of the Colour wheel sprite. Remember that the ball will only pass through the colour wheel and reach the reward if it is the same colour as the Colour wheel segment.

Add this script ..

 

18. Time to add the final script to the ball ..

 

19. Test your game by pressing "B" to begin your game. Use the Up arrow key on your keyboard to move your ball towards the Reward sprite. Remember you can END the game by pressing the "e" key.

How many reward points can you get? If you can get more than 18 you are doing well. 21 is really hard!

 

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

 

21. Well done, you're finished! Can you improve the game by changing the scripts or adding new features?