Learning Goals 3 min
By the end of this lesson you will be able to:
- Wire
when this sprite clickedtochange [score v] by (1). - Use
go to [random position v]so the target does not stay still. - Describe the three parts of a catch loop: trigger, reward, reset.
Warm-Up 7 min
Your score works. It resets, it counts, it shows itself. But nothing on the Stage makes it move — you have to press a key yourself. A game is what happens when the Stage itself decides.
Quick-fire puzzle
Faris built this on his roti sprite. It scores perfectly. He says it is boring after ten seconds. Why?
when this sprite clicked
change [score v] by (1)
Reveal the answer
The roti never moves. You park the mouse on it and click as fast as you can. There is no skill in it, so there is no game in it.
What is missing is not more scoring. It is the target getting away.
New Concept — the catch loop 15 min
Almost every simple game is the same three-step loop. Once you can name the three steps you can build dozens of games that look completely different from each other.
Blocks reference
| Block | Category | What it does |
|---|---|---|
when this sprite clicked | Events | Runs when the player clicks this sprite, not the Stage. |
go to [random position v] | Motion | Jumps to a spot Scratch picks. Different every time. |
change [score v] by (1) | Variables | Adds a point to the running total. |
wait (0.2) seconds | Control | Gives the eye a moment to follow the jump. |
Why the reset step is the game
Steps 1 and 2 give the player a reward. Step 3 takes the target away again, so the reward has to be earned a second time.
Change what step 3 does and you get a different game entirely. Jump to a random spot and it is a catch game. Shrink slightly and it is a precision game. Speed up and it is an endurance game.
Where the script lives
This one is worth saying out loud: when this sprite clicked only listens for clicks on the sprite you built it on. Build it on the roti and clicking the cat does nothing.
So the catch script belongs on the roti. The reset script — the one with set [score v] to (0) — can live on either, because a variable is shared by the whole project.
Random means unpredictable, not fair
Random position can put the roti anywhere on the Stage, including half off the edge or right under the score readout. That is not a bug. If it bothers you, that is a design problem to solve, and next lesson you will solve it.
Why it matters
You now have a project where the Stage responds to the player, and where the player’s skill changes the outcome. That is the line between an animation and a game, and you just crossed it.
Worked Example — build the catch loop 15 min
You need the roti sprite, the cat, the Blue Sky backdrop and the score variable from last lesson. Everything else you build now.
Step 1 — Score on a click
Select the roti sprite. This script goes on the roti, and nowhere else.
when this sprite clicked
change [score v] by (1)
Step 2 — Make it get away
Add the reset step. Now the roti is somewhere new before you can click it twice.
when this sprite clicked
change [score v] by (1)
go to [random position v]
Step 3 — Add the reset script
On the flag, put both the score and the roti back to a known starting state.
when flag clicked
set [score v] to (0)
show variable [score v]
go to x: (0) y: (0)
Step 4 — Prove the order matters
Swap the two blocks in the catch script so the jump comes first, then click as fast as you can.
when this sprite clicked
go to [random position v]
change [score v] by (1)
Step 5 — Make the jump readable
A tiny pause and a size flick tell the player their click landed. This is feedback, and it makes the game feel far better than it costs.
when this sprite clicked
change [score v] by (1)
change size by (20)
wait (0.1) seconds
change size by (-20)
go to [random position v]
Step 6 — Add a sound
Use start sound [Pop v] rather than play-until-done, so the sound overlaps rapid clicks instead of holding the script up.
when this sprite clicked
start sound [Pop v]
change [score v] by (1)
change size by (20)
wait (0.1) seconds
change size by (-20)
go to [random position v]
Step 7 — Play it properly
Click the flag and play for a full minute. Note the highest score you reach. You now have something a friend can lose at, which is a real milestone.
What changed: your project stopped being something you watch and started being something you play.
Try It Yourself — three small builds 12 min
Goal: Make the roti shrink a little every time it is caught, so the game gets harder as you go.
when this sprite clicked
change [score v] by (1)
change size by (-5)
go to [random position v]
Think: your flag script now needs set size to (100) % as well, or every game starts smaller than the last.
Goal: Add a second target worth more points but harder to hit.
when this sprite clicked
change [score v] by (5)
go to [random position v]
Think: both sprites change the same variable. Neither one owns it, and that is what makes a shared score possible.
Mini-mission: the thing you must not click. Add a sprite that costs points instead of giving them, so the player has to look before they click.
It works if: clicking the good one adds a point, clicking the burnt one takes three away, both jump to a new spot afterwards, and the score can go negative. Keep each stack under 8 blocks.
Think: if the two look too similar the game is unfair; if they look too different it is too easy. Where is the line?
Mini-Challenge — make it feel good to catch 5 min
“Three kinds of feedback”
The catch works. Now make the player feel it. Add one signal the eye can see, one the ear can hear, and one that reads as a number.
It works if:
- Catching gives a visible change, an audible one and a number change.
- None of the feedback stops you clicking the next roti quickly.
- Any size or colour change is undone before the roti jumps.
- The stack stays within 8 blocks.
Recap 2 min
A catch loop has three parts: a trigger, a reward, and a reset that takes the target away again. Leave out the reset and you have a clicking exercise rather than a game. when this sprite clicked only listens on the sprite you built it on, so the catch script belongs on the target. Score before you jump, or a fast click scores twice. And feedback the player can see and hear costs three blocks and changes how the whole thing feels.
- Catch loop
- Trigger, reward, reset — the three steps behind most simple games.
- when this sprite clicked
- An Events hat that runs only when its own sprite is clicked.
- go to random position
- A Motion block that jumps the sprite to a spot Scratch chooses.
- Feedback
- What the game shows or plays to tell the player their action worked.
Homework 1 min
Same loop, different game. Keep the three steps and change what each one does. You should end up with something that does not look like a roti game at all.
- Choose any sprite from the library that is not food.
- Keep the trigger and the reward exactly as they are.
- Change the reset step — instead of jumping, make it shrink, spin, or change costume.
- Play it and write one sentence on whether it is better or worse than the jump, and why.
when this sprite clicked
change [score v] by (1)
change size by (-8)
turn cw (25) degrees
Bring back next class:
- Your changed game, saved and named.
- Your answer to: “Which of the three steps did you change, and what kind of game did that turn it into?”
Heads up for next class: SCR-L01-43 is the arc finale — the full Catch the Roti Canai game, finished and ready to share.