Learning Goals 3 min
By the end of this lesson you will have:
- Built a complete, playable Catch the Kuih game from a blank project — a basket that follows your control, kuih clones falling from the top, a Score that climbs, Lives that shrink, a speed-up, and a game-over screen.
- Wired together every arc-G block — create clone of [myself v], when I start as a clone, change [score v] by (1), broadcast (game over v) — into one project with no orphan scripts.
- Shipped it — saved
L02-41-Catch-the-Kuih.sb3and shared it (with a grown-up's help for under-13s).
Warm-Up — what we're building 5 min
This is the lesson where every piece of arc G clicks together. You've spent four lessons learning the parts:
- L02-37 — clones (spawning falling kuih).
- L02-38 — catch & reset (the basket scores and snaps the kuih back).
- L02-39 — score & game over (lives + the broadcast).
- L02-40 — levelling up speed (difficulty scaling with mod).
Today, no new blocks. Just assembly. By the end of the hour your game will look like the preview above.
Reveal — the finished game
A KL-skyline backdrop. A basket at the bottom that slides with your mouse. Kuih — kuih lapis, ondeh-ondeh, kuih bahulu — falling from random points along the top. Catch a kuih and the Score goes up by 1. Miss a kuih (it hits the ground) and you lose a life. After three misses, the backdrop changes to "GAME OVER" and the kuih stop falling.
The HUD shows score top-left and lives top-right. The fall-speed climbs every 5 catches, so the game gets harder as you get better.
Keep your L02-40 project open in another tab in case you need to peek. But build today's game from a fresh project — assembling from memory is the best test that the arc has stuck.
The Game Plan 5 min
Before we type a block, here's the whole game on a napkin. Three sprites and the Stage:
- Basket (the catcher) — follows the mouse along the bottom.
- Kuih (the falling food) — hidden original. Spawns clones every ~1 second. Clones fall, get caught, or hit the ground.
- Stage — owns the variables (
score,lives,fall-speed), the two backdrops (PlayandGame Over), and the flag-click setup.
The arc-G blocks we lean on, in order of first use:
when flag clicked
set [score v] to (0)
set [lives v] to (3)
set [fall-speed v] to (5)
The Build — ten steps from blank project to playable game 28 min
Open Scratch. Start a brand-new project. Delete the cat (right-click → delete). Now we build.
Step 1 — Backdrops
Click the Stage in the bottom-right. Open the Backdrops tab. Add two: a city/KL-skyline one and a plain one to repurpose. Rename them Play and Game Over. Open the paint editor for Game Over, use the text tool, type GAME OVER big in the centre. Save.
Step 2 — Make the three variables
Variables palette → Make a Variable. Create three, all For all sprites: score, lives, fall-speed. Tick all three checkboxes. Drag the watchers — score top-left, lives top-right, fall-speed under score (small).
Step 3 — Stage setup script
On the Stage:
when flag clicked
switch backdrop to [Play v]
set [score v] to (0)
set [lives v] to (3)
set [fall-speed v] to (5)
Step 4 — The basket sprite
Sprite picker → paint a tray/basket (a flat rectangle with two little handles), or use the built-in Bowl. Name it Basket. Add the mouse-follower:
when flag clicked
go to x: (0) y: (-150)
forever
set x to (mouse x)
end
Step 5 — The kuih sprite
Sprite picker → paint or upload a kuih. Simplest: a small coloured ball in a kuih colour (kuih lapis = pink-and-green, ondeh-ondeh = green, bahulu = golden). Name it Kuih. Hide the original at the start:
when flag clicked
hide
Step 6 — The spawner
Still on the Kuih, add a second script that fires clones from the top every second:
when flag clicked
forever
create clone of [myself v]
wait (1) seconds
end
Step 7 — The clone's fall + catch detection
Still on the Kuih, add the when I start as a clone hat. Each clone places itself at a random x along the top, then falls until caught or missed:
when I start as a clone
show
go to x: (pick random (-220) to (220)) y: (170)
forever
change y by ((0) - (fall-speed))
if <touching [Basket v] ?> then
change [score v] by (1)
if <((score) mod (5)) = (0)> then
change [fall-speed v] by (1)
end
delete this clone
end
if <(y position) < (-160)> then
change [lives v] by (-1)
delete this clone
end
end
Step 8 — Game-over detection on the Stage
Back to the Stage. Add a watcher that ends the game when lives hits zero:
when flag clicked
forever
if <(lives) < (1)> then
broadcast (game over v)
switch backdrop to [Game Over v]
stop [this script v]
end
end
Step 9 — Stop the kuih on game-over
Back to the Kuih sprite. Add the receiver that stops the rain:
when I receive (game over v)
stop [other scripts in sprite v]
hide
For a tighter finish, add this on the clone path too:
when I receive (game over v)
delete this clone
Step 10 — Playtest and save
Click the flag. The KL backdrop shows. The basket pins to your mouse. Every second a kuih drops from a random x. Catch one — score 1. Catch five — fall-speed jumps to 6 and the next kuih is faster. Miss three — lives hits 0, the backdrop flips to GAME OVER, and the sky stops raining kuih.
Save the project. File → Save to your computer → L02-41-Catch-the-Kuih.sb3.
What you just built: a complete arcade game. Three sprites, several scripts, three variables, two backdrops, one broadcast. Every block was something you met in arc G. The arc is now finished.
Three Extensions — pick at least one 10 min
Goal: Multiple kuih costumes. Give the Kuih sprite three costumes (kuih lapis, ondeh-ondeh, bahulu) and pick a random one per clone.
when I start as a clone
switch costume to (pick random (1) to (3))
show
go to x: (pick random (-220) to (220)) y: (170)
Think: switch costume to () accepts a number — costume 1 is the first in the list. pick random (1) to (3) rolls the dice.
Goal: A start screen. Add a backdrop Start with "Catch the Kuih! Click to play". The game only begins when the player clicks the Stage.
when flag clicked
switch backdrop to [Start v]
set [score v] to (0)
set [lives v] to (3)
set [fall-speed v] to (5)
when stage clicked
switch backdrop to [Play v]
broadcast (start game v)
Think: Real games almost always have a start screen. You've learned the pattern — split "set up" (flag) from "go" (broadcast).
Goal: High score. Add a fourth variable, high-score. At game over, if the current score beats high-score, replace it. The watcher stays on the Stage between games.
when I receive (game over v)
if <(score) > (high-score)> then
set [high-score v] to (score)
end
Think: Every variable so far has been reset at the flag. high-score is the first that persists. Different variables have different lifespans — the lifespan is whatever your code decides.
Ship It — save, share, show the world 3 min
Polish first (5 minutes, in order)
- Sound on catch. Add start sound [Pop v] inside the catch if-then. A tiny reward per catch.
- Sound on miss. Add start sound [Boing v] inside the miss if-then. The player learns the two sounds fast.
- A title. On the
Playbackdrop, paint "🍡 Catch the Kuih" across the top so the game has a name. - Final score on Game Over. On the Stage's game-over handler, add say (join [Final score: ] (score)) for (5) seconds.
Don't over-polish before a friend has played v1. Perfectionism kills more games than bugs do.
Save it
File → Save to your computer → L02-41-Catch-the-Kuih.sb3. Keep this file safe — it is the whole game in one piece, openable on any Scratch.
Share it
If you have a scratch.mit.edu account: open the project online, click Share, then fill the Instructions ("Move the basket with your mouse. Catch the kuih, don't miss!") and Notes & Credits. Copy the project URL to show your class.
Which polish to do first?
Audio. Always audio first. A silent game feels half-finished even when the gameplay is solid. Pop on catch + boing on miss costs four blocks and makes the game ten times more fun. Visual polish second, score-text third.
Recap — arc G done 3 min
You built a complete arcade game from scratch in 60 minutes, using only blocks you'd already met. The basket follows the mouse. The kuih original is a clone factory. Each clone falls, catches, or misses, mutating two shared variables along the way. The Stage watches one variable for the game-over condition and fires a broadcast every kuih hears. The full game is three sprites, fewer than 30 blocks, and feels like many published Scratch games. That's the whole point of arcs — small pieces, big result — and you shipped it.
- Capstone
- A Build lesson at the end of an arc where every block is assembled into one complete, shippable project. Today was arc G's capstone.
- Singleton sprite
- A sprite that exists exactly once — the Basket, the Stage. Their forever loops run once. Contrast cloned sprites, where the loop runs once per clone.
- Shared variable
- A variable made For all sprites. Any sprite or clone can read or write it.
score,lives,fall-speedare all shared. - Ship
- To save a finished project and share it — as an
.sb3file or a scratch.mit.edu link. A game isn't done until someone else can play it. - Game loop
- The repeated cycle of "do something, check something, react". Each clone's loop is one; the Stage's lives-watcher is another. A game is many running in parallel.
Homework — extend with bad kuih 2 min
The Burnt-Kuih Hazard. Add a second falling sprite — a burnt kuih (or a fly, or a chilli) the player shouldn't catch. Catching one costs a life. Missing it is fine.
- Open today's
L02-41-Catch-the-Kuih.sb3. Save asHW-L2-41-Bad-Kuih.sb3. - Paint a new sprite
Bad Kuih— same shape but blackened, or a fly, whatever signals "don't catch me". - Give it the same hide-on-flag + spawner pattern, but a longer wait (maybe 3 seconds — bad kuih should be rarer).
- Its clone-fall is almost identical, but the catch is the opposite: catching it does change [lives v] by (-1) instead of scoring. Missing it does nothing — just delete.
- Give it a different sound on catch (low buzz, not pop) so the player learns the cue.
Playtest at least five rounds. The game should now reward aim — sliding under good kuih, away from bad kuih.
Bring back next class:
- The
.sb3(or your shared project link). - A screenshot of your best score.
- Your answer to: "Arc G is now done. Which lesson from L02-37..41 was the hardest, and why?"
Heads up for next class: SCR-L02-42 · Simple Pong kicks off the next cluster. We leave catching games behind for a one-paddle Pong with a bouncing ball — your first taste of velocity: a sprite has both a position and a speed, and the speed is a variable too.