🎮 Phase 3 · Game Development
🔵 Intermediate
MODULE 09
Catch Game
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!
Section 1
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
catches apple
+1 point
→
score
1
score
0
Start
lives
3
Start
speed
5
Increases
🛠️
How to CREATE a variable
Click the Variables category (dark orange) → "Make a Variable" → type a name like score → OK. Your new blocks appear instantly!
set score to 0Puts an exact number in the box (start of game: score = 0)
change score by 1Adds 1 to whatever is in the box (caught an apple: +1 point!)
change lives by -1Takes 1 away (missed an apple: lose a life!)
if lives = 0 then
say Game Over!
💬 In kid words: "Check the lives box — if it hit zero, the game ends!"
Section 2
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
Section 3
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
Falls from the sky — catch it with the bucket!
when 🚩 clicked
set score to 0
set lives to 3
set speed to 4
forever
go to x: pick random -200 to 200 y: 180
show
repeat until y position < -170
change y by -speed
if touching Bucket ? then
change score by 1
start sound pop
go to x: 999 y: 999
if y position < -170 then
change lives by -1
if lives = 0 then
say Game Over!
stop all
💬 In kid words: "The apple jumps to a random spot at the top and falls down. If it touches the bucket — point! If it reaches the floor — lose a life. No lives left? Game over!"
🎯
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
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.
Module 09 of 16Phase 3 — Game Development