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 ..

 

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. Download, save and then open this game file ..

 

 

3. Now add this code/scripts onto the stage ..

 

 

4. 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 ..

 

 

5. Click the "only face left right" button ..

If you are using Scratch desktop add this code ..

Add this code/scripts to the Cat ..

 

NOTE: 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.

 

Press "B" to test your game.

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

 

 

6. Use the File menu to save your game. Name you game "Space invaders v1" ..

 

 

7. Add this code/scripts to the Cat bullet which the Cat will fire whenever you press the space-bar ..

 

Press "B" to test your game.

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

 

 

8. Add this code/scripts to the Invader ..

 

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

 

Press "B" to test your game.

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

 

 

9. Use the File menu to save your game.

 

 

10. Now add this code/scripts to the Invader Bomb ..

 

Press "B" to test your game.

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

 

 

11. Finally, add this code/scripts to the Game Over sprite ..

 

Press "B" to test your game.

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

When you are ready press "E" to end your game.

 

 

12. Use the File menu to save your game.

 

 

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