Scratch game making tutorial 83

School trip

In this tutorial you will create a game in which a teacher (you) must protect their pupils from being kidnapped by a duck!

The pupils follow the teacher but often fall behind and have to catch up when the teacher stops walking.

Complete these steps ..

 

1. Create a new game file.

 

2. Select the stage and create the following variables (for all "sprites") ..

Hide both variables on the stage.

Add these scripts to the stage ..

The "pupil distance" variable will allow you to control how far behind the teacher the pupils will walk. You can experiment with this number later.

Now with the stage still selected, create a background image of a park or the countryside, like this ..

 

3. Re-name the cat sprite "Teacher", then switch to the "Costume" tab and import the following 2 costumes ..

Now delete both Cat costumes.

Add the following scripts to make the teacher walk ..

In these scripts the "Is teacher walking" variable is used to record the current walking state of the teacher, and will be used by the pupils so they can decide whether to catch up or not.

 

4. Use File>Save as to save your game. Name it "School trip".

 

5. Now we need to add the duck which will appear randomly and run towards the teacher and the pupils.

Download and save the following 2 images ..

 

Click the "Choose new sprite from file" button under the the stage and import the first image.

Name this sprite "Duck".

Switch to the sprite's "costume" tab and import the second image.

Now add these scripts ..

 

6. Now we will add the first pupil. When we have finished it's scripts we will duplicate it 2 two times to create a total of 3 pupils and then make minor changes to each pupils scripts.

Download and save the following 2 images ..

 

Click the "Choose new sprite from file" button under the the stage and import the first image.

Name this sprite "Pupil 1".

Switch to the sprite's "costume" tab and import the second image.

Now add these scripts ..

 

7. Re-save your game (File>Save).

 

8. Duplicate "Pupil 1" and name it "Pupil 2". Now change the scripts for "Pupil 2" to this (there are 3 changes) ..

 

9. Duplicate "Pupil 2" and name it "Pupil 3". Now change the scripts for "Pupil 3" to this (there are 3 changes) ..

 

10. Re-save your game.

 

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

 

12. You're done! Re-save your game then press "B" or click the Green Flag to test it.

 

13. Can you improve it? What else could you add?