To program this game, we will use the Scratch platform which has the advantage of using visual code: no need to learn a programming language to build your own games and videos!

Target group
School drop outs, Students (primary school), Students (secondary school)
Age group
Children, Teenagers
Proficiency level i
Level 2
Format
Activity sheet
Copyright i
Creative Commons (BY-SA)
Language
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

Resource originally created in

French
Workshop directions

Creating a backdrop

We will first create the playing field. Go to ‘Stage’ in the bottom right corner of the screen and choose a theme (for example ‘woods’ in ‘nature’).  

Programming a mischievous ghost

Delete the cat – we won’t need it.
1. You can now create a new sprite.
Click on the sprite icon below the stage. Choose a ghost from the Scratch library (in ‘Fantasy’ for example).
2. Now we will want to make the ghost move.
Add a variable by going to the ‘Variable’ tab and clicking on ‘Create a Variable’ and name it ‘Speed’. When the variable options appear, tick the box ‘For all sprites’. In this way the variable will apply equally to all future sprites and not only the one currently selected.
Deselect ‘Speed’ in the list of variables so it is not displayed on the stage. The variable ‘speed’ will allow us to set the ghost’s speed.
3. To make the ghost move across the screen, put together the following code. The module ‘set rotation style’ is not obligatory but it will ensure the ghost doesn’t turn upside down.
Test the code by clicking the flag. The ghost should move over and back.

Making the ghost appear and disappear randomly

To make the game more interesting, we can make the ghost appear and disappear randomly. We need to write more code that will be executed alongside the other one. This second code, also in the ghost’s script, will hide the ghost for a random duration, then will make it appear again for a random amount of time. This pattern will repeat until the end of the game.

Write the following code:

Test the code by clicking on the green flag: the ghost should move over and back while disappearing and appearing at random intervals.

Making the ghost disappear when clicked on

For our program to become a game, we need to give the player something to do. Here, they will need to click on the ghosts to make them disappear. When the player clicks on a ghost, its disappearance should be accompanied by a sound effect. 1. First choose a sound effect. In the ‘Sounds’ tab, add a new effect by clicking on ‘Record’. Record whatever sound you like.

2. Write the following code in the ghost’s script:

Adding a timer and a point counter

We have almost everything we need to bring the game to life. All we are missing are the timer and point counter! The player will win points every time they click on the ghost. There will be limited time to win a maximum number of points. We will use variables to keep track of the points and the time. First create a variable ‘score’. Go back to ‘variables’, then ‘create a new variable’. Like the first tick the box ‘For all sprites’. Name it ‘Score’. Change the previous code to increase to score by one point each time the player clicks on a ghost.

Create another variable, again applied to all sprites, called ‘Timer’. Write a code that will set the timer to 30 seconds and put to score to 0 as soon as the player clicks the green flag. We will use the instruction ‘repeat until’ to wait a second and then reduce the timer by one. This operation should repeat itself until the timer reaches 0.  

Bonus

We can make the game more interesting by adding more ghosts. Here’s how to do it:

  • Copy the ghost by right-clicking on the ghost in the sprites window.
  • You can then make the game more complex:
  • You could change the sizes of the ghosts;
  • change their speed;
  • move them around the stage so they don’t all move at on the same axis.
  • For the more daring: why not spice up the game? Try to create ghosts of different speeds. The quicker the ghost the more points they carry (for this you will need to make additional speed variables and set them so they each affect different ghosts).