Scratch games making tutorial 144

Spin it!

In this tutorial you will create a game in which you must spin boxes to earn points.

 

Complete these steps ..

 

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

 

 

2. Select the cat sprite and right-click to delete it.

 

 

3. Select the stage, then select the Backgrounds tab and edit the stage so it is black.

 

Now add these scripts begin and end your game ..

 

 

4. Create the following variables ("for all sprites") ..

 

The "box size" variable will be used to refine the size of the games Box sprites. Hide it on the stage but leave Points and Timer visible like this ..

 

 

5. Add these script to the stage. They will initialise the points and box size variables ..

You can refine the box size amount later. Bigger sizes will make the game easier.

 

 

6. The game will end after 60 seconds. Add the timer script ..

 

 

7. Use "File>Save as" to name and save your game. Name it "Spin it" ..

 

 

8. Click the "Paint new sprite" button under the stage and create a square with 2 coloured halves like this ..

 

 

9. Name the new sprite "Box 1" and then add the first script ..

 

Notice how this box will be positioned in the bottom left corner of the screen. Press "B" now and it will move there.

 

 

10. The player will need to rotate the box 180 degrees so that it's top colour matches that of falling sprites.

Add this script ..

 

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

Press the "E" key to end your game and continue working on it.

 

 

11. A single box is not enough. Duplicate it 5 times until you have 6 box sprites.

 

In order to spread them out, each box sprite needs a different x axis positioning at the bottom of the stage. Edit each box sprites "got to x ?" scripts to match these values ..

Sprite x value
Box 1 -200
Box 2 -120
Box 3 -40
Box 4 40
Box 5 120
Box 6 200

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

Press the "E" key to end your game and continue working on it.

 

 

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

 

 

13. You need to create a simple sprite which will fall from the top of the screen.

Paint a new sprite like this with the same colour as one half of your boxes (in this case red) ..

 

 

14. Re-name the sprite "faller 1" and add this script ..

 

Now add the script to make it fall ..

 

Notice how the script send the sprite to a random location (x: -200 to 220) along the top of the stage (y: 160) each time it starts to fall.

Also notice how points are added or lost depending on which box colour it touches.

 

 

15. Duplicate the sprite and re-colour it to the unused box colour (in this case orange) ..

 

 

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

 

Well done, you've finished this tutorial! Play the game.