Learning Goals 3 min
By the end of this lesson you will be able to:
- Build a two-sprite catch game using a roti canai that glides from top to bottom of the Stage.
- Wire up a when this sprite clicked hat block so clicking the cat counts as a "catch" and bumps the score.
- Click the green flag and play your finished catch game — score goes up, roti loops back to the top.
Warm-Up 7 min
Last lesson you used change [score v] by (1) inside a tiny catch loop. Today we wrap everything into a real, finished Hari Raya open-house mini-game — and then ship it.
Quick-fire puzzle
Aiman built this short stack on the roti canai sprite. Predict — what does the roti do when the green flag is clicked?
when flag clicked
set y to (180)
glide (3) secs to x: (0) y: (-180)
Reveal the answer
The roti canai jumps to the top of the Stage (y = 180), then glides smoothly down to the bottom (y = -180) over 3 seconds. After that, the script ends — the roti just sits at the bottom. To make it drop again and again, we'll wrap the drop inside a forever loop later in the lesson.
New Concept — building a two-sprite catch game 15 min
A catch game has three jobs: the falling thing drops down the Stage, the catcher reacts when clicked, and the score remembers how many catches happened. Each job lives in its own short script. We'll spread those scripts across two sprites: the cat (catcher) and the roti canai (falling thing).
The blocks we'll snap together
| Block | Category | What it does |
|---|---|---|
| when flag clicked | Events | Starts a script when the green flag is pressed. |
| when this sprite clicked | Events | Starts a script when YOU click the sprite on the Stage. |
| set y to (180) | Motion | Snaps the sprite straight to a specific y-position (top of Stage). |
| glide (3) secs to x: (0) y: (-180) | Motion | Smoothly slides the sprite to a target position over a set number of seconds. |
| forever | Control | Repeats the blocks inside, again and again, until the red stop sign is clicked. |
| set [score v] to (0) | Variables | Resets the score back to zero at the start of the game. |
| change [score v] by (1) | Variables | Adds one to the score — the "+1 per catch" effect. |
| say (score) for (1) seconds | Looks | Cat shows the current score in a speech bubble. |
The Stage layout
The roti canai sprite starts at the top (y = +180). The cat sprite waits at the bottom (y = -120) as the catcher. Click the cat just as the roti reaches it — that's a "catch".
Why it matters
This is your first two-sprite game. You'll see that each sprite has its own scripts, running side by side — that's how every Scratch game grows beyond a single-sprite animation.
Worked Example — build the game, sprite by sprite 15 min
Open Scratch. You'll build four short scripts across two sprites. Take it one sprite at a time.
Step 1 — Set up the cat catcher
The default cat is already on the Stage. Click the cat in the Sprite list. In the Sprite Properties panel, set x = 0, y = -120, Size = 80. The cat now sits near the bottom of the Stage.
Step 2 — Add a roti canai sprite
Click the blue cat-plus icon at the bottom right (Choose a Sprite). Pick any round-ish food sprite — "Bread" works well. Rename it Roti Canai in Sprite Properties. Set Size = 60.
Step 3 — Make a score variable
Click the Variables category (orange). Click "Make a Variable". Name it score, choose "For all sprites", and tick its checkbox so it shows on the Stage.
Step 4 — Script A: reset the score (on the cat)
Click the cat in the Sprite list. In the Script Area, snap together:
when flag clicked
set [score v] to (0)
Step 5 — Script B: catch the roti (on the cat)
Still on the cat. Drag a when this sprite clicked hat from Events into a fresh area of the Script Area. Snap two blocks under it:
when this sprite clicked
change [score v] by (1)
say (score) for (1) seconds
Step 6 — Script C: drop the roti (on the roti canai)
Click the Roti Canai card in the Sprite list. Build this stack:
when flag clicked
forever
set y to (180)
glide (3) secs to x: (0) y: (-180)
end
Step 7 — Click the green flag and play
Click the green flag. The roti zips to the top, glides down over 3 seconds, then resets and drops again. Each time you click the cat, the score jumps up by 1 and the cat says the new score.
What changed: compared to the single-sprite scripts you've seen so far, this game has multiple sprites running scripts at the same time — the roti is gliding while the cat is waiting to be clicked.
The full assembled stacks (your reference)
when flag clicked
set [score v] to (0)
when this sprite clicked
change [score v] by (1)
say (score) for (1) seconds
when flag clicked
forever
set y to (180)
glide (3) secs to x: (0) y: (-180)
end
Try It Yourself — extend the project 12 min
Goal: Make the roti drop faster. Change the glide time from 3 seconds to 1.5 seconds. Click the flag — the roti now zips down in half the time.
when flag clicked
forever
set y to (180)
glide (1.5) secs to x: (0) y: (-180)
end
Think: A smaller glide time means a faster drop — and a harder game.
Goal: Make the roti drop from a different x position each time. Change set y to (180) to go to x: (-150) y: (180) on one loop, then build a second loop that drops it at x = 150. (Hint: add another forever script with a different x — we don't have random yet, so use fixed positions.)
when flag clicked
forever
go to x: (-150) y: (180)
glide (3) secs to x: (-150) y: (-180)
go to x: (150) y: (180)
glide (3) secs to x: (150) y: (-180)
end
Think: The roti alternates left side, then right side. The cat has to keep moving its eyes across the Stage.
Goal: Make the cat celebrate when the score reaches 5. Add a third script to the cat that watches the score and changes its costume to surprised. Hint: a forever loop with a wait until won't work yet (booleans are L2). Instead, just use the cat's own click script to trigger a celebration when the bubble looks right.
when this sprite clicked
change [score v] by (1)
next costume
say (score) for (1) seconds
Think: Every click now flips the cat to its next costume and bumps the score. Celebrate on every catch.
Mini-Challenge — add a teh tarik sprite 5 min
"Two foods to catch"
Add a second falling sprite — a cup of teh tarik — that drops at a different speed than the roti. Clicking it should also raise the score.
It works if:
- Two sprites are now falling at the same time (roti AND teh tarik), each on their own column.
- Each falling sprite has its own when flag clicked → forever drop loop.
- The score bumps up no matter which falling sprite you click.
- You used only blocks and ideas from this lesson plus earlier lessons (no broadcasts, no sensing).
Reveal one valid solution
Duplicate the roti sprite (right-click → Duplicate). Rename the copy Teh Tarik. Change the teh tarik's drop column to x = -100 and the roti's to x = 100. Give the teh tarik a slower glide (4 secs) so the two foods don't always reach the bottom together.
when flag clicked
forever
go to x: (-100) y: (180)
glide (4) secs to x: (-100) y: (-180)
end
when this sprite clicked
change [score v] by (1)
The teh tarik's own click handler bumps the score by 1 — just like the cat's does. Each falling sprite is its own self-contained mini-machine.
Recap 2 min
Today you built your first two-sprite catch game. The roti canai sprite drops on its own loop while the cat sprite waits to be clicked. A score variable counts every catch. Multiple short scripts on multiple sprites — that's how every Scratch project scales.
- glide (block)
- Smoothly slides a sprite to a target x/y over a chosen number of seconds.
- when this sprite clicked (block)
- An Events hat that starts a script when the user clicks the sprite on the Stage.
- two-sprite project
- A project where two or more sprites each carry their own scripts and run side by side.
- score variable
- A named bucket that counts something — here, the number of successful catches.
Homework 1 min
Catch the Kuih. Remix your roti canai game so the falling sprite is a piece of kuih instead. Pick any food-shaped sprite from the library, rename it Kuih, and adjust the glide speed so the game feels "just right" for you.
- Open your Catch the Roti Canai project from class.
- Right-click the roti sprite → Delete (or hide it).
- Add a new sprite, rename it Kuih, place its scripts where the roti's were.
- Test by clicking the flag and playing five rounds. Note your best score.
- Take a screenshot of the Stage with your best score showing.
Bring back next class:
- A screenshot of your kuih-catch Stage.
- Your written answer: "What glide time felt too easy? Too hard? Just right?"
Heads up for next class: SCR-L01-44 Cat Chase swaps the falling-food game for a chase game. You'll use the four arrow-key hat blocks to drive the cat around the Stage.