Learning Goals 3 min
By the end of this lesson you will be able to:
- Drop a create clone of (myself v) inside a forever + wait (1) seconds stack and explain why the wait is non-negotiable.
- Read the dropdown on the spawner —
myselffor cloning this sprite, or any other sprite name for cloning a different one (e.g., create clone of (Sprite2 v)). - Predict what each clone inherits from the original at the moment of cloning: same position, same costume, same direction, same size, same sprite-only variable values.
Warm-Up — the 300-clone explosion 7 min
Last lesson you learned the mental model. Today the blocks come out. But first, a warning.
Imagine you drag create clone of (myself v) onto the Stage and put it inside a forever loop, like this — no wait:
when flag clicked
forever
create clone of (myself v)
end
How long does it take before this project hits the 300-clone cap?
Reveal the answer
About 10 seconds. 30 spawns per second × 10 seconds = 300 clones. After that, the cap is hit, the spawner goes silent, and your project freezes with 300 invisible duplicates piled on top of the original. The fan in your laptop may spin up. This is the most common "first day of clones" mistake — and the fix is one block: a wait (1) seconds inside the forever, before the create clone.
Today's pattern is the spawner pattern: forever → wait → create clone. Memorise the shape. You'll write it in every Cluster-D project from here to the end of the cluster.
New Concept — the spawner block in detail 15 min
The block in question is small but worth picking apart.
The block itself
create clone of (myself v)
When this block fires, Scratch instantly makes a new clone of whichever sprite the dropdown names. It's not a loop, not a hat — it's a one-shot block. Each call makes exactly one clone.
The dropdown — myself vs. another sprite
Click the little ▾ arrow in the dropdown. You'll see:
- myself — clones the sprite that this script is on. 99% of the time you'll use this. Inside the Star sprite's scripts, create clone of (myself v) makes a clone of Star.
- Every other sprite name in the project — Sprite2, Bullet, Star, whatever. Picking one of these clones that other sprite instead of yourself.
when this sprite clicked
create clone of (Sprite2 v)
The most common cross-sprite pattern is Player fires Bullet: the Player sprite, when space is pressed, calls create clone of (Bullet v). The Bullet sprite (usually hidden in a corner) has a when I start as a clone hat that flies forward and deletes on edge. We'll wire this exact pattern in SCR-L03-22.
The spawner pattern — forever + wait + create
The almost-always-correct shape of a spawner is:
when flag clicked
forever
wait (1) seconds
create clone of (myself v)
end
Three reasons the wait (1) seconds matters:
- Cap protection. One clone per second is sustainable. Thirty per second isn't.
- Visual sense. A user can see clones appearing once a second. Thirty per second looks like instant fog.
- Performance. Even before the 300-cap, hundreds of running clone scripts slow Scratch down. Spacing them out keeps things smooth.
You can change the wait. Bullets in a shooter game often use wait (0.2) seconds — five bullets per second. Raindrops might use wait (0.5) seconds — two drops per second. Slow drifting clouds might use wait (3) seconds. In our Falling Stars Cloud we'll use 0.3 for a lovely gentle drizzle of stars. Tune the wait to the project.
What each clone inherits
At the exact moment create clone of (myself v) fires, Scratch takes a snapshot of the original and stamps out a copy. The clone inherits:
- Position — the original's x and y at that instant.
- Direction — wherever the original is pointing.
- Size — the original's size percent.
- Costume — whichever costume the original is currently showing.
- Visibility — if the original is hidden, the clone starts hidden too (you can show in the clone's start-hat).
- Sprite-only variables — each clone starts with the original's current values, but can change them independently afterwards.
That snapshot is one of the most useful properties of clones. Want each star to start at a different x? Move the original to a new x before each create clone of call — or, better, let each clone pick its own random x inside the when I start as a clone hat (that's Lesson 22's job).
Worked Example — one Cat, one clone a second 12 min
Open Scratch. We'll build the simplest possible clone-spawning project — no clone scripts yet, just the spawner — so you can see the cap rise. Eight steps.
Step 1 — Start fresh
New Scratch project. Default Cat. Position the Cat at x: 0, y: 0 (centre of the Stage).
Step 2 — Turn on the clone count watcher
This trick is only for today: make a variable called clone count (Variables palette → Make a Variable → for this sprite only). Tick its checkbox so it shows on the Stage. We'll use it to see clones being born.
Step 3 — Reset clone count on flag
From Events: when ⚑ clicked. From Variables: set [clone count v] to (0). Snap them.
Step 4 — Add the spawner loop
From Control: forever. Snap it under the set block. Inside the forever, snap wait (1) seconds first.
Step 5 — Add the spawner block
From Control (scroll to the bottom): create clone of (myself v). Snap it under the wait, still inside the forever. The dropdown should already say myself — leave it.
Step 6 — Bump the counter so we can see clones happen
From Variables: change [clone count v] by (1). Snap it under the create clone block. Each clone-birth bumps the watcher.
Step 7 — Click the flag
The clone count watcher starts at 0. After 1 second: 1. After 2 seconds: 2. After 10 seconds: 10. The clones are appearing — but you can't see them yet because they're sitting on top of the Cat with no movement script. The watcher proves they exist.
Step 8 — Try the dropdown
Stop the project. Add a second sprite (Choose a Sprite → Ball, or any sprite). Now go back to the Cat's create clone of (myself v) block, click the dropdown, and pick Ball instead. Click the flag again. The watcher still rises — but now it's Balls being cloned, not Cats. Same spawner, different target.
The full assembled stack
when flag clicked
set [clone count v] to (0)
forever
wait (1) seconds
create clone of (myself v)
change [clone count v] by (1)
end
What you just built: the heartbeat of every Cluster-D project. One clone per beat, forever, until you stop the project or hit the 300-cap. Next lesson (SCR-L03-22) we add when I start as a clone so each clone does something visible — and the Stage finally lights up with motion.
Try It Yourself — three spawner drills 15 min
Goal: Modify the worked-example spawner so it spawns a clone twice as fast (one every 0.5 seconds). Hit the flag and check that the clone count watcher hits 10 in five seconds instead of ten.
when flag clicked
set [clone count v] to (0)
forever
wait (0.5) seconds
create clone of (myself v)
change [clone count v] by (1)
end
Think: The wait is the dial. Smaller wait = more clones per second = faster march toward the 300-cap. With wait (0.5) seconds you'll cap out at 150 seconds (2.5 minutes). With wait (1) seconds it's 5 minutes. Plan accordingly.
Goal: Build a "press space to clone" spawner — one clone per key press, not on a timer. Hint: use when [space v] key pressed as the hat. No forever, no wait.
when [space v] key pressed
create clone of (myself v)
change [clone count v] by (1)
Think: You just built the foundation of a shooter. Each space press = one bullet. Holding space spams clones rapidly — you can add a wait (0.2) seconds inside if you want to throttle the fire rate.
Goal: Two sprites: a Launcher (any sprite) at the bottom of the Stage, and a Bullet (a small ball, hidden at x: 0, y: 0). The Launcher, when clicked, calls create clone of (Bullet v). Use the dropdown to clone the Bullet, not yourself.
when this sprite clicked
create clone of (Bullet v)
Think: Cross-sprite spawning is the foundation of every shooter, tower-defense, and bullet-hell game. The Launcher shouts "spawn!" via create clone of (Bullet v); the Bullet's own when I start as a clone hat handles "fly upward". Two sprites, one idea.
Mini-Challenge — Daniel's clone explosion 5 min
"My laptop is screaming"
Daniel built this spawner and ran it for twenty seconds. The Stage went strange, the fan kicked in, the clone count watcher froze at 300, and clicking Stop took several seconds. Here's his stack:
when flag clicked
set [clone count v] to (0)
forever
create clone of (myself v)
change [clone count v] by (1)
end
What's missing, and why does it matter so much?
Reveal one valid solution
Daniel forgot the wait (1) seconds inside the forever. Without a wait, the forever loop runs about 30 times per second, which means Scratch tries to create 30 clones per second. In ten seconds — 300 clones. Cap hit. Spawner silenced. Project frozen.
The fix is one block:
when flag clicked
set [clone count v] to (0)
forever
wait (1) seconds
create clone of (myself v)
change [clone count v] by (1)
end
Now Daniel gets one clone per second. He could push it to wait (0.1) seconds for a heavy storm, or wait (3) seconds for a slow drip. The wait is the dial — but some wait must be there. Lesson: the spawner pattern is forever → wait → create clone. Skipping the wait isn't an optimisation; it's an off-by-30x mistake.
Recap 3 min
You met the spawner. create clone of (myself v) is the one-shot block that, every time it fires, makes a new clone of the dropdown's target sprite. The spawner pattern wraps it in forever + wait (N) seconds so clones appear at a controlled rate — usually one every 0.2 to 1 seconds. Switch the dropdown from myself to another sprite name (like Bullet or Sprite2) to clone a different sprite. Each new clone inherits the original's position, direction, size, costume, and sprite-only variables at the exact moment of cloning. Next lesson the clones finally come alive with when I start as a clone.
- Spawner
- The script (usually on the original sprite) whose job is to create clones. Almost always shaped as forever + wait + create clone of (myself v).
- create clone of (target v)
- The spawner block. The dropdown picks which sprite gets cloned.
myself= the sprite this script is on. Any other name = that sprite gets cloned instead. - Spawn rate
- How often new clones are made. Controlled by the wait (N) seconds inside the spawner loop. Smaller N = faster spawn = closer to the 300-cap.
- Cross-sprite cloning
- One sprite (the "launcher") calls create clone of (otherSprite v) to spawn copies of a different sprite. Foundation of shooters, raindrop generators, and any "one thing spawns many of something else" pattern.
- Inheritance (at clone-time)
- Each new clone starts with a snapshot of the original's position, direction, size, costume, visibility, and sprite-only variables, taken at the exact instant create clone of fires.
Homework 2 min
The Spawn-Rate Lab. One sprite, one variable, and a slider you can tune.
- One sprite (Cat is fine). One variable
clone count(sprite-only). Show it on the Stage. - Set
clone countto 0 on the flag. Add the spawner pattern: forever → wait → create clone → change clone count by 1. - Make a second variable called
spawn delay(for all sprites). Right-click its watcher on the Stage → slider. Right-click again → set min and max → min 0.1, max 3. - In the spawner, replace the fixed wait (1) seconds with wait (spawn delay) seconds.
- Run the project. Drag the slider while it's running. Watch the clone-count watcher speed up and slow down in real time.
Save as HW-L3-21-Spawn-Rate-Lab.sb3. Show your teacher how the slider changes the spawn rate live, and how the clone count reaches 300 faster at smaller slider values.
Bring back next class:
- The
.sb3file. - Your answer to: "At
spawn delay = 0.5, how many seconds will it take to hit the 300-clone cap? Show your maths." (Answer: 150 seconds = 2.5 minutes — but write the maths.)
Heads up for next class: SCR-L03-22 meets when I start as a clone — the hat that gives every clone its own life. Today the clones were invisible because they had nothing to do. Next lesson, they finally move.