🎮 Phase 3 · Game Development 🔵 Intermediate MODULE 09

Catch Game

⏱️ 40 min
📖 Theory + Build
🧩 5 Quiz Questions
🎮 Full Game Build
Your progress in Phase 325%
🎯 What you'll learn: Variables — the backbone of all games. Learn to create, read, and update variables to track score, lives, and speed. Then build a complete Catch Game where falling objects must be caught!

Variables — The Memory of Your Game

A variable is like a named box that stores a number or text. Your game remembers things — the score, how many lives are left, the player's speed — all using variables!

HOW VARIABLES WORK
score
0
Player
catches apple
+1 point
score
1
score
0
Start
lives
3
Start
speed
5
Increases
Creating and using variables
SCRATCH BLOCKS
-- How to CREATE a variable --
Go to Variables category → "Make a Variable" → type name → OK

-- Key variable blocks --
set [score] to (0)       ← set to a specific value
change [score] by (1)    ← add 1 to current value
change [lives] by (-1)   ← subtract 1 from value

-- Use variables in conditions --
if <(lives) = 0> then
  say [Game Over!]

Anatomy of a Catch Game

Let's plan our game before we build it. Good coders plan first, code second!

🏏
The Catcher (Bucket)
Moves left and right with arrow keys. Player controls this.
← → arrow keys · change x by
🍎
The Falling Object (Apple)
Falls from top to bottom. Resets to random position at top.
go to random · change y by · forever
🏆
Score System
Score increases when apple is caught. Lives decrease when missed.
change score by 1 · change lives by -1
Difficulty Increase
Every 5 points, the apple falls faster using the speed variable.
change speed by 1 · if score mod 5 = 0

Build: Catch Game Step by Step

1
Create variables
Variables → Make a Variable → create three: score, lives, speed. Tick "Show variable" for score and lives (they'll display on stage).
2
Set up sprites
Add a "Bowl" or "Bucket" sprite for the catcher. Add an "Apple" or "Star" for the falling object. Add a colourful backdrop.
3
Code the bucket (movement)
On Bucket sprite: when 🚩 clicked → forever → if left arrow pressed then change x by -10 → if right arrow pressed then change x by 10.
4
Code the falling apple
On Apple sprite: forever loop. Go to random x, y:180. Then repeat until y < -170: change y by -(speed). Then check if touching bucket or missed.
5
Add scoring
If touching bucket → change score by 1 → play sound. If y reaches bottom without touching bucket → change lives by -1.
6
Add Game Over
Check lives after each miss. If lives = 0 → stop all sounds → say "Game Over! Score: (score)" → stop all.
Apple Sprite — Complete Falling Logic
SCRATCH BLOCKS
when 🚩 clicked
set [score] to (0)
set [lives] to (3)
set [speed] to (4)

forever
  -- Reset apple to top --
  go to x: (pick random -200 to 200) y: (180)
  show

  -- Fall down --
  repeat until <(y position) < -170>
    change y by (-speed)

    -- Caught by bucket! --
    if <touching [Bucket]?> then
      change [score] by (1)
      play sound [pop]
      go to x: (999) y: (999) ← move off stage

  -- Missed — hit bottom --
  if <(y position) < -170> then
    change [lives] by (-1)
    if <(lives) = 0> then
      say [Game Over!]
      stop [all]
🎯
Make it harder as you play!
Add this after change score by 1: if (score mod 5 = 0) then change speed by 1. This increases speed every 5 points — the game gets harder the better you do!
🧩 Knowledge Check — Lesson 9
5 questions on variables and game building!
1. What is a variable in Scratch?
2. What does "change [score] by (1)" do?
3. How do you detect if the bucket is touching the apple sprite?
4. Where do you create a new variable in Scratch?
5. How do you make the falling apple get faster over time?
💪
Game Dev Challenge — Lesson 9
Variable mastery · Intermediate Level
Challenge: Two-Type Catch Game! 🍎🍊

Upgrade your Catch Game with two types of falling objects!

Requirements:
1. Add a second falling sprite — a "bomb" or "bad object"
2. If you catch the apple → +1 score
3. If you catch the bomb → -1 life AND play an explosion sound
4. Add a "High Score" variable that saves the best score across games
5. Display a "New High Score!" message when you beat the record
💡 Show hints if you're stuck
  • The bomb sprite works the same as the apple — falls from top, but on catch it subtracts a life
  • High Score: at game over, if score > highScore then set highScore to score
  • Make bombs fall slightly faster than apples using a different speed variable
  • Use a red backdrop flash when a bomb is caught: change ghost effect → wait → change back
Finished this lesson?
Mark it complete to track your progress.
🎮

Lesson 9 Complete!

Variable master! Next up: Maze Game — learn colour detection for even smarter collision!

Module 09 of 16Phase 3 — Game Development