Student Subscription site screenshot Subscribe now

Subscribe to our Student Site to access all of our Games Coding Lessons for just £8 per month


Scratch game making lesson 044

First person shooter (FPS) - intermediate

In this lesson you will create a FPS in which multiple enemies attack you. You will lose health if they touch you. You must stop as many as possible before losing all your health.

You will aim with your mouse-pointer and fire with the space-bar.

 

NOTE: You must use Scratch 3 or higher.

 

Complete these steps ..

 

1. Open Scratch, OR use File > New to create a new game ..

 

 

2. Download, save and then open this game file ..

 

 

3. Create two new variables (for all sprites) ..

Arrange them on the stage like this ..

 

 

4. Select the Stage.

There are three stage backdrops ..

 

Add this code to the Stage ..

 

Now add the code to the Stage to control the backdrop switching ..

 

 

5. The game uses 4 sprites ..

 

Select the Player sprite and add its properties code ..

 

Now add the code to the Player sprite animate the sprite ..

Press the B key on your keyboard to test your code.

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

 

 

6. Select the Sites sprite

Add its code ..

Press the B key on your keyboard to test your code.

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

 

 

7. Select the Player bullet sprite.

Add its code ..

Press the B key on your keyboard to test your code.

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

 

 

8. Select the Enemy sprite.

There will be 5 enemy clones.

Add its cloning code ..

 

Set the variables for the when the game begins on the Enemy sprite ..

 

We need the enemies to run towards the player sprite from the top of the stage and get bigger the closer they get. You also want their movements to be random.

Add this code to the Enemy sprite..

Press the B key on your keyboard to test your code.

Your enemies should spawn at the top of the screen and then move towards you until they disappear.

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

 

 

9. Use File > Save to your computer to save your game. Name it FPS intermediate v1.sb3

 

 

10. Well done, you've finished this lesson. Can you add your own ideas?