Learning Goals 3 min
By the end of this lesson you will be able to:
- Identify the when I start as a clone hat block in the Control palette and explain that it fires only on clones, never on the original sprite.
- Write a clone-only stack that runs independently for every clone — each copy gets its own private run-through of the script.
- Spot the difference between scripts under when ⚑ clicked (run only on the original) and scripts under when I start as a clone (run only on clones), and avoid the trap where a forever loop on the original accidentally affects every clone too.
Warm-Up — one cat, ten cats 7 min
Last lesson (SCR-L03-21) you met create clone of (myself v). You wrote a spawner that fires clones every second. But every clone just sat on top of the original — same x, same y, same direction. Boring.
when flag clicked
repeat (10)
create clone of (myself v)
wait (0.5) seconds
end
If you wanted each clone to appear at a different x-position and start falling down on its own, where would you put the "go to a random spot, then fall" code? Under the when ⚑ clicked hat? Under a new hat just for clones?
Reveal the answer
Under a new hat just for clones — that's what today's lesson is about. If you put "go to random x, then fall" under when ⚑ clicked, it only runs on the original cat, once. The ten clones don't run that stack — they're not the original. They need their own hat: when I start as a clone. That hat fires once, on each clone, the instant the clone is born.
Today you'll meet that hat and use it to turn boring stacked clones into ten stars raining down from the top of the Stage — the third step toward the Falling Stars Cloud.
New Concept — the clone-only hat 15 min
Every script in Scratch starts with a hat block — the rounded-top block that decides when the script runs. You already know lots of hats: when ⚑ clicked, when [space v] key pressed, when this sprite clicked. Today we meet a hat that lives in the orange Control palette, not Events, because it's tightly tied to cloning.
Where to find it
Open the Control palette. Scroll right to the bottom. You'll see three clone-related blocks together: when I start as a clone, create clone of (myself v), and delete this clone. Today is the first one.
when I start as a clone
"Only on clones" is the whole rule
Here is the one rule you must remember:
- when ⚑ clicked runs only on the original sprite, never on clones.
- when I start as a clone runs only on clones, never on the original.
They are perfect opposites. The original cat never executes a clone-hat stack. The clones never execute a flag-clicked stack via their own birth — only via the original triggering them, which it doesn't.
Each clone runs its own copy, independently
Here's the magic part. Imagine you write this clone-hat stack:
when I start as a clone
go to x: (pick random (-200) to (200)) y: (180)
show
forever
change y by (-3)
end
You make ten clones with a spawner. Every single one of those ten clones runs the stack above at the same time — but each with its own random x, its own y, its own forever loop. Clone 1 might be at x: −187; clone 2 at x: 42; clone 3 at x: 156. They fall together but independently. Scratch is running ten little parallel scripts, one inside each clone's head.
The trap: the original is still there too
This is where most beginners trip. Cloning does not delete the original. The original sprite is still on the Stage, running its own scripts. If the original sprite also has a forever loop on it — say, under when ⚑ clicked — that loop is still ticking. It won't fire on the clones (different hat), but it will still fire on the original.
when flag clicked
hide
repeat (10)
create clone of (myself v)
wait (0.5) seconds
end
The original star would otherwise sit in the middle of the Stage looking awkward. Hide it. The clones each show themselves in their own clone-hat stack, so the user only sees the clones — exactly what we want for the Cloud.
Worked Example — falling raindrops 12 min
We're going to make ten raindrops fall from the top of the Stage to the bottom, each at a random x-position. Open Scratch.
Step 1 — New sprite
Delete the default cat. Click the Paint icon to draw a new sprite — a small blue oval works. Name it Raindrop. Centre the costume on its drawing canvas.
Step 2 — The spawner on the original
Click the Raindrop sprite. Drag in when ⚑ clicked from Events. Snap on hide from Looks — we don't want the original visible.
Step 3 — The repeat-create loop
From Control: repeat (10). Inside it, create clone of (myself v) and wait (0.5) seconds. This makes ten raindrops, half a second apart.
Step 4 — The clone-hat
Drag when I start as a clone from Control onto a fresh part of the script area. This is a separate stack — it does not snap onto the flag-clicked stack.
Step 5 — Random starting x at the top
From Motion: go to x: () y: (). Drop it under the clone hat. For x, drop in pick random (-200) to (200) from Operators. For y, type 180.
Step 6 — Show the clone
From Looks: show. Each clone starts invisible (because the original was hidden), so each must show itself.
Step 7 — Fall forever
From Control: forever. Inside it: change y by (-3). The clone now drifts downward, frame after frame.
Step 8 — Hit the flag
Click the green flag. Ten raindrops appear one by one at the top, each at a different x, and rain down toward the bottom of the Stage. The original Raindrop is invisible (hidden in Step 2). The clones never stop falling — we'll fix that in L03-23 with delete this clone.
The full assembled stacks
when flag clicked
hide
repeat (10)
create clone of (myself v)
wait (0.5) seconds
end
when I start as a clone
go to x: (pick random (-200) to (200)) y: (180)
show
forever
change y by (-3)
end
What you just built: the foundation of every Scratch shooter, bullet-hell, falling-stars, and rain-drop project. One spawner, many independent actors. Add a player sprite that catches them and you've got a game.
Try It Yourself — three clone-hat drills 15 min
Goal: Spawn five clones of any sprite. Each clone should appear at a random x between −150 and 150, at y: 0, facing right. (No falling yet — just appear.) Hide the original.
when flag clicked
hide
repeat (5)
create clone of (myself v)
end
when I start as a clone
go to x: (pick random (-150) to (150)) y: (0)
point in direction (90)
show
Think: Notice there's no forever in the clone stack — the clone just runs go to, point, show once and then stops. The clone still exists; it's just standing still.
Goal: Build a fireworks effect. Spawn one clone every time the space key is pressed. Each clone appears at the mouse pointer position and shrinks down to nothing over one second. (Hint: set size to (100) % at birth, then a repeat (20) with change size by (-5).)
when [space v] key pressed
create clone of (myself v)
when I start as a clone
go to (mouse-pointer v)
set size to (100) %
show
repeat (20)
change size by (-5)
end
hide
Think: Each spark is its own clone with its own shrinking loop. Press space ten times fast and you'll see ten sparks at ten different mouse positions, all shrinking independently. That's clone independence in action.
Goal: A swarm of bees. Spawn ten clones at the flag. Each clone starts at a random spot on the Stage (random x, random y), then drifts in a random direction forever. Each bee should also turn a tiny bit each frame so they wobble. Use the same sprite, one costume — just the clone hat to give each one its own life.
when flag clicked
hide
repeat (10)
create clone of (myself v)
end
when I start as a clone
go to x: (pick random (-220) to (220)) y: (pick random (-160) to (160))
point in direction (pick random (-180) to (180))
show
forever
move (2) steps
turn cw (10) degrees
if on edge, bounce
end
Think: One clone-hat stack. Ten independent bees. If you wrote this with ten separate sprites instead, you'd have ten identical scripts to maintain. Clones let you write the bee's brain once.
Mini-Challenge — Aisyah's stuck stars 5 min
"Why are all my stars in the same place?"
Aisyah is building a falling-stars project. She wants twenty stars to fall from random positions at the top. She writes this stack on her Star sprite:
when flag clicked
go to x: (pick random (-200) to (200)) y: (180)
show
repeat (20)
create clone of (myself v)
wait (0.3) seconds
end
when I start as a clone
forever
change y by (-3)
end
Click the flag mentally. Where does each clone start? Why are they all stacked in one column?
Reveal one valid solution
Aisyah's go to x: (pick random...) y: (180) runs on the original, under when ⚑ clicked — so it picks one random x once. Every clone then inherits the original's position at birth, so they all spawn in the same column. They fall correctly (the clone hat handles that) but they don't spread out.
The fix is to move the random-x line into the clone hat, so each clone picks its own random x when it's born:
when flag clicked
hide
repeat (20)
create clone of (myself v)
wait (0.3) seconds
end
when I start as a clone
go to x: (pick random (-200) to (200)) y: (180)
show
forever
change y by (-3)
end
Now every clone runs go to x: (pick random...) y: (180) for itself, at its own birth, with its own random number. Twenty stars, twenty different starting columns. The clone hat is where "per-clone" decisions belong.
Recap 3 min
You met the second of Scratch's three clone blocks. when I start as a clone is a hat block that fires only on clones, once per clone, the instant each clone is born. The original sprite never executes this stack — it runs when ⚑ clicked instead. Every clone runs its own independent copy of the stack with its own random numbers, its own loops, and its own variables (if "for this sprite only"). The trick is to put per-clone decisions (random x, starting direction, looks effects) inside the clone hat, and shared setup (hide the original, spawn the clones) under flag clicked. Next lesson you'll learn how to delete clones so they don't pile up forever.
- Hat block
- A block with a rounded top that starts a stack. It decides when the stack runs. when I start as a clone is a hat that only triggers on clones.
- Clone
- A temporary copy of a sprite, made by create clone of (myself v). It shares the original's costumes and code, but has its own position, direction, and (sometimes) variables.
- Original sprite
- The sprite that exists from the start of the project. The original runs when ⚑ clicked stacks. It does not run when I start as a clone stacks.
- Independent execution
- Each clone runs its own copy of the clone-hat stack at the same time as the others. Ten clones means ten parallel runs of the same script, each with its own loop counters and random numbers.
- Spawner
- The stack that creates clones — usually under when ⚑ clicked on the original, with a repeat or forever around create clone of (myself v).
Homework 2 min
Pisang Goreng Rain. Build a one-sprite project where pisang goreng (or any food sprite — draw your own) rain down from the top of the Stage.
- Pick or draw a small food sprite. Hide the original under when ⚑ clicked.
- On the original, spawn 15 clones, half a second apart, using repeat (15) and create clone of (myself v).
- On the clone hat (when I start as a clone): go to a random x between −220 and 220 at y: 170, then show, then forever change y by (-4).
- Bonus: give each clone a random starting size between 50% and 100% so big ones and small ones rain together.
Save as HW-L3-22-Pisang-Goreng-Rain.sb3. The clones will fall off the bottom of the Stage and pile up invisibly — that's fine for now. Next lesson we delete them.
Bring back next class:
- The
.sb3file. - Your answer to: "What happens if you accidentally put create clone of (myself v) inside the clone hat instead of inside the flag-clicked stack? Try it for one second, then stop. What did you see?"
Heads up for next class: SCR-L03-23 meets delete this clone — the block that removes a clone when it's no longer needed. Without it, today's homework clones pile up forever and eventually break the project. We'll fix that.