Stage 5: Spawn Patterns
Stage 5: Spawn Patterns
Keep your Scratch project tab open all week. Open in a new tab so you don’t leave the course.
cloned spike patterns
how one template sprite can create many obstacles
a level that keeps producing jumps
- Hide the original Spike template.
- Create clones on a timed loop.
- Each clone starts on the right, moves left, then deletes itself.
- Change one random number to make gaps less predictable.
The big idea
Clones let one Spike sprite become a whole level. The template holds the costume and scripts; each clone becomes one obstacle run.
- clone
- a temporary copy of a sprite made while the project runs
- template
- the original sprite used to create clones
- pattern
- a repeated obstacle idea
- random
- letting Scratch choose a value inside a range
Stage 4 should be done. One scrolling spike works.
Students may follow these examples or draw their own versions in Scratch. Keep the sprite names from the lesson.
Follow the target shapes shown here so your scripts match the lesson quickly.
Draw a custom cube, spikes, portal, or backdrop in Scratch. Keep the same sprite names so the code still works.
The cube stays near the left side while the level scrolls toward it. Jump timing is the whole game.
Build it
- Click the Spike sprite and keep its costume.
- Replace the single-spike scroll with a clone spawner.
- Use create clone of myself every 1.4 seconds while gameOn is 1.
- Put movement code inside when I start as a clone.
- Delete clones when they leave the left edge or when the game stops.
Spike clone spawner
when green flag clicked hide forever if <(gameOn) = (1)> then create clone of [myself v] wait (1.4) seconds end end when I start as a clone go to x: (260) y: (-100) show repeat until <<(x position) < (-260)> or <(gameOn) = (0)>> change x by (-6) end delete this clone
Understand it
The template is hidden, but clones show themselves. That pattern prevents the original sprite from sitting on the stage and causing surprise crashes.
Try this
Try this
Three short experiments. Predict before you run, then test your guess.
Test your stage
- The original Spike is hidden when the game starts.
- Spike clones appear on the right.
- Each clone moves left and deletes itself.
- Crash detection still works when touching a clone.
If it breaks
- If too many clones pile up, check delete this clone.
- If the original spike is visible, add hide under green flag.
Keep students moving on the default path first. Custom assets are encouraged, but the required names and variables are not optional. If debugging takes more than a few minutes, compare the student's sprite names, variable names, and block order against the stage test list.