Scratch game making tutorial 156a

Cog wars simple

In this tutorial you will create a game in which the player must avoid spinning cogs to avoid losing points and earn new points.

 

 

Complete these steps ..

 

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

 

 

2. Right-click on the cat sprite thumbnail under the stage and delete it ..

 

 

3. Select the stage Backgrounds tab and paint the stage black ..

 

 

4. Add these script to the stage ..

 

 

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

 

Locate their displays on the stage like this ..

 

 

6. . The player must earn as many points as possible before a countdown ends.

Points are earned automatically every 5 seconds, but are lost if the players Cog1 hits another cog. Add this script to the stage ..

 

 

7. Finally, we need a countdown script. The player will have 1 minute (60 seconds) to gain as many points as possible. Add this to the stage ..

 

 

8. Use "File>Save as" to name and save your game. Name it "Cog wars simple" ..

 

 

9. Next, download, save and then use the "choose new sprite from file" button under the stage to import these 8 sprites ..

Cog1.sprite

Cog2.sprite

Cog3.sprite

Cog4.sprite

Cog5.sprite

Cog6.sprite

Cog7.sprite

Game over.sprite

 

 

10. Select the Cog1 sprite. Each cog sprite uses pen scripts to draw its own path behind it on the stage.

The player will control the direction of this sprite with the mouse-pointer. Add the first script ..

 

Press the "B" key on your keyboard and then the "E" key. The red Cog1 should be visible on the stage.

Now you must click on the colour square in the "set pen color to" script and then click on the red part of the cog sprite on the stage to sample and set the correct red colour in the script.

 

 

11. Add the main script to control the movement of Cog1 and determine what will happen when it touches the yellow teeth of other cogs.

NOTE: Make sure you sample the yellow teeth colour of any cog on the stage or a cog thumbnail image under it ..

 

Press the "B" key on your keyboard to test your game. Move the mouse-pointer around the stage.

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

 

 

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

 

 

13. Select the Cog2 sprite. This sprite is going to move automatically.

Add the first script ..

 

 

14. Now add the second script. Make sure you sample the cogs main colour ..

 

Press the "B" key on your keyboard to test your game. The sprite should move around the stage and draw its path behind it.

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

 

 

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

 

 

16. Duplicate (copy) the 2 Cog2 scripts to the all the remaining cog sprites.

Now on all of the cogs, you must click on the colour square in the "set pen color to" script and then click on the main colour part of the cog sprite to set the correct colour for their paths.

 

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

Check the following ..

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

 

 

17. Select the Game over sprite and add its scripts ..

 

 

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

 

 

19. Well done, you've finished the game. How any points can you earn before the time runs out?