Scratch game making tutorial 44

FPS - First person shooter (01)

In this tutorial 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.

In this tutorial you will create the following sprites ..

IMPORTANT NOTE! Although the steps to create this game are in order (1, 2, 3 etc), some of the scripting cannot be completed until you have finished later steps.

 

1. Create a new game (File>New).

 

 

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

 

 

3. Create three stage backgrounds and name each carefully ..

 

 

4. You will need the stage to change to an appropriate background at the right times. Add these scripts to the stage ..

Save your game.

 

 

5. Paint a bullet to fire at the enemies and name it "player bullet". Ensure it is pointing right ..

If you like you can import this sprite (right-click to download)

 

 

6. Import this machine gun sound effect onto your bullet (right-click to download)

 

 

7. Add these scripts to the bullet ..

NOTE: You will need to complete the "go to player" script block once you have completed step 11 in this tutorial, and the repeat loop part of this script once you have created all your enemies in step 8.

Save your game.

 

 

8. Create an enemy sprite with two costumes ..

Ensure you name your sprite "Enemy 01" and each costume ..

If you like you can import this sprite (right-click to download)

 

 

9. You need the enemy to run towards you from the top of the screen and get bigger the closer he is. You also want his movements to be random. Add these scripts to the enemy ..

Save your game.

 

Test this sprite / script to see if it is working. Your enemies should spawn at the top of the screen and then move towards you until they dissapear. If all is well, duplicate your enemy sprite 4 times and name each so you have ..

Now you can go back and finish the "repeat until" script block in the bullet script (step 7).

 

 

10. Paint some simple sights / cross-hairs and name them "sights" ..

 

Add this script ..

Save your game.

 

 

11. Now its time to create the hands holding the gun which the player will fire. You will need three named costumes ..

This sprite should be named "Player". You can paint your own or import this sprite (right-click to download).

You will need to set the costume centre points to the end of the barrel in the paint window of each costume ..

 

Now you can go back and finish the "Go to player" script block in the bullet script (step 7).

 

 

12. Add these scripts to the player sprite ..

Save your game.

 

 

13. Well done, you're finished. Now test and debug any scripting errors.

 

 

14. Perhaps you can think of some mods to improve it?