This workshop tutorial is based on the programming tool Scratch. Participants will learn to make a simple space video game using the Scratch software. Making sounds, the background, shuttle, sprites, scorecards, meteorites should be interesting especially for children and adolescents

Target group
School drop outs, Students (primary school), Students (secondary school)
Age group
Children, Teenagers
Proficiency level i
Level 2
Activity sheet
Copyright i
Creative Commons (BY-SA)
English, French , Français

General Objective

Skillset building

Preparation time for facilitator

less than 1 hour

Competence area

3 - Digital content creation

Time needed to complete activity (for learner)

0 - 1 hour

Name of author

Xavier Moreau - VDN Gaité

Support material needed for training

A computer with Scratch or internet connection

Resource originally created in

Workshop directions


We will program a game in which the player will navigate a spaceship to avoid meteors. For every meteor shot, 1 point is gained. As this is relatively complex due to the use of clones, it is recommended for an audience already familiar with Scratch.

Drawing the backdrop

Hover over the ‘backdrop’ icon on the bottom right of the creation screen, then click the ‘Paint’ icon. With the ‘Rectangle’ tool, make the backdrop all black. With the ‘Brush’ tool, make many white points to represent stars. The size of the points can be changed by changing the number shown below.

Creating the rocket

Click on the sprite icon near the bottom right and choose ‘Rocketship’ from the library. Delete the default cat sprite. Click on the ‘Costumes’ near the top left of the screen. Now reduce the default costume to about a 5th of its initial size. Do this by selecting the ‘Select’ tool, clicking the costume on the bitmap, and clicking on one of the points on the rectangle that will appear. Meanwhile, delete the exhaust smoke graphic.

It needs to be turned by the mouse. For Scratch to do this correctly, the sprite needs to be in the right orientation from the beginning, i.e. pointing to the right. For this, rotate the costume by clicking on it with the select tool then using the rotation handle as shown here:

Make sure the sprite is at the centre of the screen.   In the ‘Code’ tab near the top left of the screen, copy the following to the ship’s script:

Code explanation: when the game starts, the rocket will go to the centre of the screen. It will always point towards the cursor.

Creating meteors

Click on the sprite icon, choose ‘Rocks’ and rename it ‘Meteor’.

On the ‘Costumes’ tab, reduce the size to around one third of the default. The meteor needs to move in a straight line and bounce off the edges. Add the following to its script:

Code explanation: at the beginning, the meteor is appears randomly and will point in a random direction. In the loop (‘Forever’), it moves indefinitely (3 steps). If it touches the edge, it bounces. Click on the green flag to test the result. If the meteor touches the ship, the game should end in defeat. Any meteor can end the game – we therefore need to add the following code to loop (inside ‘Forever’):

Code explanation: if the ship is touched, the meteor says ‘Game Over!’ and the program stops. One meteor is not enough to make the game interesting. Each time the meteor touches the edge, it should duplicate itself to increase the difficulty. Add the following instruction between ‘if touching edge then’ and ‘if on edge, bounce’:
Problem: with the current code, the meteor can potentially appear on the ship at the beginning. The game would immediately stop so we need to stop this from happening. Change the random values for y so that the meteorite appears at the top of the screen at the beginning (here between 100 and 175):

Click on the green flag to test the result. Another problem: the clones are created but they don’t move. This is because each clone created has the same code as the original. This code says the clone should move when the green flag is clicked, but as the clone is created after the green flag is clicked, its code is not executed. Thus, the clone never starts its movement. We must then change the clones’ code so that they use ‘when I start as a clone’ instead of ‘when the green flag is clicked’. How do we do this? First we copy the original code. Right click on it and click ‘Duplicate’ then change the first block to ‘when I start as a clone’. To prevent each clone from creating clones of themselves, which would make the game impossible’, remove the block ‘create clone of myself’.

Adding the ability to shoot

Now we need to let the ship be able to defend itself. Create a new sprite using the ‘Paint’ tool, use the ‘Circle’ tool and make a round shape. Place the sprite at the centre and name it ‘Shot’. Click on the ‘Code’ tab and copy the following:

The player needs to be able to shoot by pressing the space bar. Add the following:
Code explanation: when space is pressed, the program places the shot at the middle of the screen under the ship (x=0, y-0) and makes it appear (‘show’). The shot moves towards where the cursor was when space was pressed. It will continue in a straight line until it touches either the edge or the meteor. When either of these things happens, it disappears (‘hide’). Click on the green flag to test the result. We now need to program the meteors to disappear when they are touched, as for now shooting them does nothing. Regarding the meteor’s script, add this to the loop (‘forever’). Here is the complete script:

Code explanation: if the meteor is touched by the shot, it disappears. So the game can continue, it will then reappear elsewhere as a new meteor. Add code to make the clones also disappear when hit by the shot using ‘delete this clone’ (so to not delete the ‘real’ meteor). We do not have to make destroyed clones reappear.

Click the green flag to test. Everything should now work but we can only shoot once, which is a little limiting. To solve this, we can also clone shots. Change the shot’s script as follows by cutting the previous group into the following two pieces:

Code explanation: the ‘real’ shot hides itself under the ship and will never appear or move. However, each time the player shoots, a clone will appear and it is this that will be used. The program will create as many clones as necessary, so the player can shoot as many times as they want. Make sure you change the last block to from ‘hide’ to ‘delete this clone’.


Now all we need to do is add a way to count points. Make a new variable and call it ‘Score’. Set its initial value to 0 in the meteor’s script.

Simply add a ‘change score by 1’ block to the meteor’s script, making sure to put it in the right place. Place it within the condition that tests if the shot is touched (‘if touching shot then’):

Add the same to the clones’ script:

Going further

Some ways to improve the game:

  • Add sound effects for shooting and meteor explosions
  • Add an ‘explosion’ costume for the meteor and switch to it when the meteor is shot
  • Duplicate the ‘Meteor’ sprite to increase the difficulty
  • Assign random speeds to the clones to make them less predictable and therefore harder to hit
  • Have the sizes of the clones change randomly