Scratch game making tutorial 86

Space invaders

In this tutorial you will create a space invader game in which the cat battles a space invader. The cat must inflict as much damage on the invader before the cat loses all their lives.

The cat will fire bullets at the invader, and the invader will drop bombs.

Complete these steps ..

 

1. Create a new game (From the top menu choose File>New).

 

2. Right-click and delete the cat sprite.

 

3. Download, save, and then use the "Choose new sprite from file" button under the stage..

.. to load these following 4 sprites (complete with their costumes) ..

 

4. Download and save this background image ..

Click the stage thumbnail, then select the "Backgrounds" tab and then "Import" to load the image.

Delete the default white blank background image.

 

5. Now add these scripts onto the stage ..

 

6. Save your game using "File>Save as". Name you game "Space invaders" and click OK.

 

7. Create the following variables (select "for all sprites") ..

Hide the "invader speed" variable on the stage. We will use this variable to speed up the invader whenever it takes damage from the Cat's bullet.

Position the other two variables at the bottom of the stage like this ..

 

8. Add these scripts to the Cat ..

Notice how the arrow key scripts have special "if" blocks to make sure only the first two cat costumes are used when the cat moves.

Also, notice how the costume changes to "hit" whenever an Invader bomb or the Invader touches the Cat.

 

9. Re-save your game using File>save.

 

10. Add these scripts to the Cat bullet which the Cat will fire whenever you press the space-bar ..

 

11. Add these scripts to the Invader ..

 

Notice how the Invader not only increases damage but also speeds up ("change invader speed by 2") whenever a Cat bullet touches it.

 

12. Re-save your game using File>Save.

 

13. Now add these scripts to the Invader Bomb ..

 

14. Finally, add these scripts to the Game Over sprite ..

 

13. You're done! Save your game again then press "B" or click the Green Flag to test it.

How much damage can you inflict on the Invader before the Cat lives are gone?

 

14. Can you improve the game? What else could you add? More Invaders?