GAME RULES

Learn what variables are and add a score to your Scratch game!

Lesson: T1 — L07 Time: ~75 min Tool: Scratch + Canva Outcomes: G5-1, G5-2, G5-4
LEARNING SUPPORT VERSION

1 What Are Game Rules?

Words to Know

Variable
A value that can change — like score, lives, or speed
Score
A number that counts points
Lives
How many chances the player has
HUD
Heads-up display — info shown on screen like score and lives
Every game has numbers that change. Your score goes up when you collect things. Your lives go down when you get hurt. A timer counts down. Speed can change as the game gets harder.
These changing numbers are called variables. A variable is like a labelled box that holds a number — and that number can go up or down during the game.
Real game examples:
- Minecraft: hearts (lives), hunger bar, XP level
- Fortnite: shield bar, materials count, health
- Mario: coin counter, lives, time remaining
Tell your partner: What are 3 variables in YOUR favourite game? (Think about numbers on the screen that change.)
I can name 3 variables in my favourite game.

2 Add a Score to Scratch

Open Scratch and load your L06 project (the one where the cat moves with arrow keys).
Step 1: In the Block Palette (left side), click on Variables (orange section). You will see orange blocks appear.
Step 2: Click the Make a Variable button at the top of the orange section. A pop-up window appears asking for a name.
Step 3: Type Score as the variable name and click OK. A score display appears on the stage! You will also see new orange blocks with "Score" in them.
Now let's make the score start at 0 every time the game begins:
Step 4: From Events (yellow section), drag "when green flag clicked" into the Coding Area. This block runs when you start the game.
Step 5: From Variables (orange section), drag "set Score to 0" and snap it underneath the green flag block. Now every time you click the green flag, the score resets to 0.
when green flag clicked
set Score to 0
Now let's make the score go up when you press a key:
Step 6: From Events, drag a new "when [space] key pressed" block into the Coding Area (separate from the other stack). This will listen for the space bar.
Step 7: From Variables, drag "change Score by 1" and snap it underneath the space key block. Now pressing space adds 1 to the score.
when space key pressed
change Score by 1
Test it! Click the green flag, then press Space multiple times. Watch the score go up on the stage!
Score not showing? Make sure the checkbox next to "Score" is ticked in the Variables section. That checkbox controls whether it shows on the stage.
When I press the green flag, score resets to 0. When I press space, score goes up by 1.

3 Make Score Go Up When Touching Something

Let's add a second sprite (a star) and make the score go up when the cat touches it!
Step 1: Look at the bottom-right of the stage area. Click the Choose a Sprite button (it looks like a cat face with a + icon). A sprite library opens with lots of characters and objects.
Step 2: In the search bar, type star and click on the Star sprite to add it. A star appears on the stage alongside your cat!
Step 3: Go back to the cat sprite by clicking the cat thumbnail below the stage. Important! The code we write next goes on the CAT, not on the star.
Now we will make the cat check constantly if it is touching the star, and add points if it is:
Step 4: Find your existing "when green flag clicked" stack (with "set Score to 0"). We will add to it.
Step 5: From Control (orange section), drag a "forever" block and snap it under "set Score to 0". The forever block is a loop — it keeps checking over and over.
Step 6: From Control, drag "if < > then" and place it inside the forever block. This is a decision block — it checks a condition.
Step 7: From Sensing (light blue section), drag "touching [mouse-pointer]?" into the diamond-shaped hole in the if block. Click the dropdown and change it to Star. Now it reads: "if touching Star then".
Step 8: From Variables, drag "change Score by 1" inside the if block. Change the 1 to 10. Now touching the star adds 10 points!
when green flag clicked
set Score to 0
forever
if touching Star? then
change Score by 10
Test it! Click the green flag. Use arrow keys to move the cat to touch the star. The score should go up!
Star score going up too fast? That's OK for now! We will fix it next lesson using an if-then block with a wait.
When my cat touches the star, the score goes up!

4 Design a Game HUD in Canva

A HUD (heads-up display) is the information overlay that players see during gameplay. Think of the health bar, score, and mini-map in your favourite games. Now you will design one!
Step 1: Open Canva in your browser (canva.com) and sign in. You see the Canva home screen.
Step 2: Click Create a design (top-right). Choose Custom size and type 1920 x 1080 px. Click Create new design. A blank widescreen canvas opens — this is the same size as a game screen.
Step 3: Make the background dark (black or dark grey). Click the background, then click the coloured square to change it. A dark background looks like a real game screen.
Step 4: Click Text in the left panel. Add a heading. Type Score: 0 and drag it to the top-left corner. Make the text white or green. This is where the player's score would appear.
Step 5: Add another text box. Type Lives: 3 and drag it to the top-right corner. This shows how many lives the player has.
Step 6: Click Elements in the left panel. Search for heart. Choose a heart icon and place it near the "Lives: 3" text. The heart icon visually represents lives — just like in real games!
Step 7: Search Elements for timer or clock. Add a timer icon somewhere on the HUD (e.g. top-centre). Your HUD now has score, lives, and a timer — the three most common HUD elements.
Step 8: Rename your design. Click the title at the top and type: L07 - Game HUD - [Your Name] Your HUD design is saved!
Look at your partner's HUD. Does it show score, lives, and at least one icon? Give them a thumbs up or a suggestion!
My HUD shows score, lives, and at least one icon.

5 Save Your Work

Save your Scratch project:
Step 1: At the top of the Scratch editor, click on the project name. The text becomes editable.
Step 2: Type: L07 - Score Variable - [Your Name] Your Scratch project is renamed and saved automatically!
Save your Canva HUD: Your Canva design saves automatically. Just make sure it is named "L07 - Game HUD - [Your Name]".
What I Learned
Write 1-2 sentences about what you learned today.
Today I learned that variables are... I added a score to my game by... My HUD design includes...