Learning Goals 3 min
By the end of this lesson you will be able to:
- Use
next costumeand explain what happens at the end of the list. - Rebuild a walk cycle with fewer blocks than before.
- Animate a sprite whose costume names you have never looked at.
Warm-Up 7 min
Your walk cycle works, but look at the cost. Six blocks inside the loop, two of them just naming costumes — and it only works for a sprite with exactly two poses, called exactly those names.
Quick-fire puzzle
Wei Jie replaced his two costume blocks with one he had never used before. It still worked. What does this block do?
when flag clicked
repeat (8)
next costume
wait (0.2) seconds
end
Reveal the answer
It steps to the following costume in the list, and when it runs off the end it loops back to the first. So on a two-costume sprite it alternates, exactly like the pair of blocks it replaced.
The important part is what it does not need: no names, no knowledge of how many costumes there are. It just moves along.
New Concept — stepping through the list 15 min
Think of the costume list as a ring rather than a line. next costume takes one step round the ring, and after the last costume the next step brings you back to the first.
Blocks reference
| Block | Category | What it does |
|---|---|---|
next costume | Looks | Moves to the following costume, wrapping back to the first after the last. |
switch costume to [costume2 v] | Looks | From last lesson. Jumps to one named costume. |
Why the wrap-around matters
With two costumes, wrapping produces a perfect alternation and you barely notice it. With four, you get a proper four-frame cycle. With one, the block does nothing at all — there is nowhere to step to.
When to use which
| What you want | Which block |
|---|---|
| Cycle through poses to animate | next costume |
| Set a specific pose at a specific moment | switch costume to [costume2 v] |
| Reset to a known starting pose | switch costume to [costume1 v] |
| Animate a sprite whose costumes you have not looked at | next costume |
In practice the two work together: a switch at the top of a script to guarantee a known starting pose, then next costume inside the loop to do the animating.
Why it matters
Animation stops being something you build laboriously for one sprite and becomes something you can add to any sprite in two blocks. That difference decides whether you bother.
Worked Example — the same walk, half the blocks 15 min
We rebuild last lesson’s walk cycle, then use the spare blocks for something the old version had no room for.
Step 1 — Count the old version
Look at last lesson’s walk. Eight blocks, six of them inside the loop, and two of those six exist only to name costumes.
Step 2 — Replace the pair with one block
Delete both switch blocks from inside the loop and drop in a single next costume.
when flag clicked
go to x: (-160) y: (0)
repeat (8)
next costume
move (40) steps
wait (0.2) seconds
end
Step 3 — Run them side by side
Genuinely identical. All you have removed is the part where you told Scratch something it could work out for itself.
Step 4 — Guarantee a clean start
There is one thing the old version had by accident: a known starting pose. Add a switch above the loop to get it back deliberately.
when flag clicked
go to x: (-160) y: (0)
switch costume to [costume1 v]
repeat (8)
next costume
move (40) steps
wait (0.2) seconds
end
Step 5 — Spend the block you saved
You are still a block under the cap, so add a line of dialogue at the end — something the old eight-block version had no room for at all.
Step 6 — Try it on a sprite with more costumes
Select Abby, who has four costumes rather than two, and give her the same loop. It works immediately, cycling all four. The old named-costume approach would have needed four blocks and four correct names.
That is the real argument for this block. It is not that it saves two blocks on the cat — it is that it works on any sprite without you knowing anything about it.
What changed: animating a sprite went from a chore worth avoiding to two blocks you can add to anything.
The full assembled stack (your reference)
when flag clicked
go to x: (-160) y: (0)
switch costume to [costume1 v]
repeat (8)
next costume
move (40) steps
wait (0.2) seconds
end
say [Made it!] for (2) seconds
Try It Yourself — three small builds 12 min
Goal: Make the cat jog on the spot. No travel at all — just the legs.
when flag clicked
repeat (10)
next costume
wait (0.15) seconds
end
Think: four blocks, no motion blocks, and the cat is clearly moving. Remove the wait and it becomes an orange blur instead.
Goal: Animate Abby, who has four costumes rather than two. Use the same loop and see what a longer cycle looks like.
when flag clicked
repeat (12)
next costume
wait (0.2) seconds
end
Think: twelve steps through a four-costume ring is exactly three full cycles. With the cat’s two costumes it would be six. Same script, different sprite, different answer.
Mini-mission: the tidy finish. Build a walk that always ends with the sprite standing in its normal pose, however many steps it took to get there.
It works if: the walk animates properly and the sprite is always in its standing pose at the end — even if you change the number of repeats to an odd number. Keep the stack under 8 blocks.
Think: next costume cannot control where it stops. Which other block can, and where does it have to go?
Mini-Challenge — animate a stranger 5 min
“A sprite you have never met”
Add any sprite from the library that you have not used before, and animate it — without opening its Costumes tab first.
It works if:
- One flag click animates the new sprite.
- You wrote the script before checking how many costumes it has.
- The animation reads as movement rather than a random flicker.
- You can say afterwards how many costumes it turned out to have, from watching alone.
Reveal one valid solution (teacher)
when flag clicked
repeat (12)
next costume
wait (0.2) seconds
end
The last criterion is the good one — pupils can count the cycle length by watching for the repeat. Some library sprites have costumes that are alternative characters rather than animation frames, and cycling those looks strange. That is worth discovering rather than being warned about.
Recap 2 min
The costume list is a ring. next costume takes one step round it and wraps from the last back to the first, which means it needs no names and no knowledge of how many costumes there are. Pair it with a switch above the loop when you need a known starting or finishing pose. It works on any sprite, which is what makes animation something you will actually use.
- next costume
- A Looks block that steps to the following costume, wrapping round after the last.
- Costume ring
- The way the costume list behaves — after the last one, back to the first.
- Animation cycle
- One complete pass through all of a sprite’s costumes.
- Starting pose
- The costume a sprite is set to before an animation begins, so runs look identical.
Homework 1 min
Two sprites, two speeds. Animate two different sprites side by side and give each one a pace that suits it.
- Put the cat and one other sprite on the Stage.
- Give each an animated walk using
next costume. - Tune the two wait times so the sprites feel like different creatures.
- Screenshot both Script Areas and note your two wait values.
when flag clicked
switch costume to [costume1 v]
repeat (8)
next costume
move (30) steps
wait (0.2) seconds
end
Bring back next class:
- Your screenshots and your two wait values.
- Your answer to: “Why does the same script animate a two-costume sprite and a four-costume sprite without any changes?”
Heads up for next class: SCR-L01-28 teaches size — how to make a sprite grow, shrink, and come back to normal.