Learning Goals 3 min
By the end of this lesson you will be able to:
- Use the next costume block to flip through a sprite's costume list.
- Combine forever, next costume, and wait (0.2) seconds to make a sprite look like it's walking.
- Run two scripts at the same time — one that animates the costumes, one that slides the sprite across the Stage.
Warm-Up 7 min
Last lesson (Arc 4/7) you used switch costume to [costume2 v] to jump to one chosen costume. Today (Arc 5/7) you let Scratch flip through them automatically — that's how walking cartoons are made.
Quick-fire puzzle
Wei Jie built this stack on the cat (which has two costumes: costume1 and costume2). He clicked the green flag. What did the cat do?
when flag clicked
repeat (4)
next costume
wait (0.5) seconds
end
Reveal the answer
The cat switched costumes four times, half a second apart. Because the cat has only two costumes, the loop went: costume2 → costume1 → costume2 → costume1. To your eyes, the cat looked like it was wiggling its legs in place.
That wiggle is the start of an animation. Speed it up and add some sideways motion — and the cat looks like it's walking.
New Concept — next costume + the walking-animation pattern 15 min
Cartoons trick your eyes. They show many still pictures in a row, very fast. Your brain joins them up and sees movement. Scratch does the same: each costume is one still picture; next costume flips to the one after it. Flip fast enough and the sprite looks alive.
Today's new blocks
| Block | Category | What it does |
|---|---|---|
| next costume | Looks | Advances to the next costume in the Costumes tab. If it's already on the last one, it loops back to the first. |
| forever | Control | (Recap from earlier.) Runs everything inside it over and over, until you click the stop sign. |
| wait (0.2) seconds | Control | (Recap from earlier.) Pauses for the number of seconds you type. Decimals work — try 0.1 for fast, 0.5 for slow. |
The walking-animation pattern
One pattern, three blocks. It's the classic:
when flag clicked
forever
next costume
wait (0.2) seconds
end
The cat now wiggles its legs continuously. But it's stuck in one spot — the legs move, the cat doesn't go anywhere. To make it walk across the Stage, you add a second script that handles the sideways motion. Two scripts, running at the same time on the same sprite.
The Stage view
Why it matters
A walking cat is a tiny piece of magic. In every game and animation you'll ever build, sprites need to look like they're doing what they're doing — running, jumping, eating, dancing. next costume is the simplest, friendliest way to do that.
Worked Example — the walking cat 15 min
Open Scratch. The cat sprite comes with two built-in costumes (costume1 and costume2), where the legs are in different positions. We'll use those.
Step 1 — Position the cat at the left edge
Click the cat in the Sprite list. In Sprite Properties, set x to -200, y to 0, and Direction to 90 (facing right).
Step 2 — Build the costume-flip script
From the yellow Events category, drag a when ⚑ clicked into the Script Area. From the orange Control category, drag a forever beneath it. From the purple Looks category, drag a next costume inside the forever. Add a wait (1) seconds and edit the number to 0.2.
when flag clicked
forever
next costume
wait (0.2) seconds
end
Step 3 — Build the sideways-motion script
Leave script #1 alone. Drag a second when ⚑ clicked into an empty space in the Script Area. Beneath it, snap a forever, a move (4) steps, and an if on edge, bounce.
when flag clicked
forever
move (4) steps
if on edge, bounce
end
Step 4 — Click the green flag
Both scripts start at the same time. The cat's legs flip every 0.2 seconds. The cat also slides 4 pixels right every fraction of a second. When it reaches the right edge, it flips around and walks the other way.
Step 5 — Tune the timing
Change the wait to 0.1 — the cat trots. Change it to 0.5 — the cat plods. Change the move from 4 to 10 — the cat zooms. Tiny number changes, big personality changes.
What changed: compared to last lesson (one switch costume block, one chosen costume), today's lesson uses a loop with next costume to flip continuously — and adds a second script for motion.
The two scripts together (your reference)
when flag clicked
forever
next costume
wait (0.2) seconds
end
when flag clicked
forever
move (4) steps
if on edge, bounce
end
Try It Yourself — three small builds 12 min
Goal: Make the cat wiggle its legs without going anywhere. Use only the costume-flip script — leave the motion script out.
when flag clicked
forever
next costume
wait (0.2) seconds
end
Think: The cat moves its legs but stays in one spot. Without a second script for motion, only the look changes — not the position.
Goal: Make Aiman's cat trot fast across the Stage. Speed up the animation and the motion. Change wait to 0.1 and move to 8.
when flag clicked
forever
next costume
wait (0.1) seconds
end
when flag clicked
forever
move (8) steps
if on edge, bounce
end
Think: Smaller wait + bigger move = faster cat. Try other combinations — what happens if the wait is 0.5 but the move is 15? (Hint: a fast-sliding cat with slow legs looks like it's gliding on ice.)
Goal: Make the cat say "Hello, KL!" before it starts walking. Add a third script that handles the greeting.
when flag clicked
say [Hello, KL!] for (2) seconds
when flag clicked
forever
next costume
wait (0.2) seconds
end
when flag clicked
forever
move (4) steps
if on edge, bounce
end
Think: Three scripts all start when the flag is clicked. The greeting runs once and stops. The other two run forever. The cat says "Hello, KL!" while wiggling and walking. Three things at once — that's the power of multiple scripts on one sprite.
Mini-Challenge — the back-and-forth pacing cat 5 min
"Faiz's Cat paces the Stage"
Build an animation where the cat walks all the way to the right edge, bounces, walks all the way back to the left edge, bounces again — and keeps doing it forever. The legs must flip the whole time.
It works if:
- You only used blocks from today's lesson and earlier.
- The cat's legs flip continuously while it walks.
- The cat bounces off both edges and never stops.
- You used two separate scripts on the same sprite.
Reveal one valid solution
Set the cat's Direction to 90 and starting x to -200. Then build the two-script combo from the Worked Example. The if on edge, bounce block handles the turnaround automatically — when the cat hits the right edge, it flips to face left; when it hits the left edge, it flips to face right.
when flag clicked
forever
next costume
wait (0.2) seconds
end
when flag clicked
forever
move (5) steps
if on edge, bounce
end
Tip: by default, the cat goes upside-down when it flips. To stop that, click the cat in the Sprite list and find the Direction circle in Sprite Properties. There's a small "rotation style" toggle — set it to "left-right" so the cat just mirror-flips instead of rolling over.
Recap 2 min
Today you learned the walking-animation pattern: a forever loop with next costume and a short wait. You ran two scripts on one sprite at the same time — one for the legs, one for the motion. That combination makes a cat walk.
- next costume (block)
- A Looks block that advances to the next costume in the Costumes tab. Wraps back to the first after the last.
- Animation
- A sequence of still pictures shown fast enough that your eyes see motion. In Scratch, each picture is a costume.
- Walking-animation pattern
- The four-block combo: forever + next costume + wait (0.2) seconds, with a hat on top.
- Two scripts on one sprite
- A sprite can run many scripts at the same time. They all start when their hat block is triggered.
Homework 1 min
Walk the cat to Penang. Build a walking-cat animation that travels from the left edge of the Stage to the right edge, then says "Sampai Penang!" ("Arrived at Penang!") for 2 seconds when it gets there.
- Open Scratch. Set the cat's starting x to
-200, Direction to90. - Build a costume-flip script using forever + next costume + wait (0.2) seconds.
- Build a motion script using repeat (50) + move (8) steps, then a say [Sampai Penang!] for (2) seconds at the end.
- Click the flag. Watch the cat walk all the way across, then greet you.
Bring back next class:
- A screenshot of your two scripts.
- Your written answer to this question: "What happens if you use repeat (50) instead of forever for the costume flip script? Does the cat still walk to Penang?"
Heads up for next class: SCR-L01-28 teaches the size blocks — change size by (10) and set size to (100) %. You'll make a sprite pulse like a heartbeat.