Learning Goals 3 min
By the end of this lesson you will be able to:
- Use hide and show to make a sprite disappear and reappear.
- Use go to front layer and go [backward v] (1) layers to control which sprite sits on top.
- Build a "magic-trick" sequence — a sprite hides for 2 seconds, then reappears in a new spot saying "Tada!".
Warm-Up 7 min
Over seven lessons you've built the Cat's Talking Cartoon — saying, thinking, switching costumes, growing, and shrinking. Today you add the final skill: making the cat appear and vanish like a real stage performer. Then you assemble everything and show it off.
Quick-fire puzzle
Iman built this stack. The cat started visible at the centre. What did the cat do after the flag click?
when flag clicked
hide
wait (2) seconds
show
Reveal the answer
The cat disappeared instantly, the Stage looked empty for two seconds, then the cat reappeared in exactly the same spot. Position and size didn't change — only visibility did.
hide doesn't delete the sprite; it just makes it invisible. Scripts still run, blocks still happen — you just can't see anything on the Stage. That's perfect for surprises.
New Concept — visibility & layers 15 min
Think of sprites like paper cutouts on a desk. Show means the cutout is lying face-up; hide means you've turned it over (still there, but blank). Layers decide which cutout is sitting on top when they overlap — a heart in front of a cat looks different from a heart behind a cat.
Today's new blocks
| Block | Category | What it does |
|---|---|---|
| show | Looks | Makes the sprite visible. Has no effect if the sprite is already visible. |
| hide | Looks | Makes the sprite invisible. The sprite is still there — scripts keep running. |
| go to front layer | Looks | Brings the sprite to the very top — in front of every other sprite. |
| go [backward v] (1) layers | Looks | Moves the sprite back by that many layers. Use the dropdown to switch between forward and backward. |
Visibility is a yes/no switch
A sprite is either visible or invisible — there's no in-between. The Show toggle in Sprite Properties (the ✓ button) is the same switch you flip with these blocks. Click it manually, or change it with a script — either way works.
Layers — the paper-cutout stack
When two sprites sit on the same spot on the Stage, one of them appears in front. Layers decide which. Imagine the Stage is a desk, and sprites are paper cutouts. The cutout you put down last is on top.
Why it matters
Hide and show are how you handle surprises: pop-up bonuses, ghost sprites, intro screens that vanish when the game starts. Layers stop sprites from awkwardly overlapping — the player's character should be in front of the background, the speech bubble should be in front of the player.
Worked Example — the magic-trick cat 15 min
Open Scratch. We'll make the cat do a magic trick: stand visible, then poof disappear for two seconds, then reappear somewhere new with a "Tada!" speech bubble.
Step 1 — Reset the cat's starting state
Click the cat. In Sprite Properties, set x to -100, y to 0. We want the cat starting on the left side of the Stage.
Step 2 — Show the cat at the start
Drag when ⚑ clicked. Snap a show beneath it. This is the "reset visibility" step — every run starts with the cat visible.
Step 3 — Add a pause so the audience sees the cat
Snap a wait (1) seconds after the show. One second of "look at me!" before the magic happens.
Step 4 — Hide the cat
Snap a hide next. The cat vanishes from the Stage.
Step 5 — Wait again, then move
Snap a wait (2) seconds. While invisible, the cat will move to a new spot. Snap a go to x: (0) y: (0) with x changed to 100. (The cat moves, but the audience can't see it move — it's hidden.)
Step 6 — Show again with a "Tada!"
Snap a show, then a say [Tada!] for (2) seconds.
when flag clicked
show
wait (1) seconds
hide
wait (2) seconds
go to x: (100) y: (0)
show
say [Tada!] for (2) seconds
Step 7 — Click the green flag
The cat sits on the left for a second… vanishes… (two seconds of empty Stage)… reappears on the right, saying "Tada!". Real magic. Real code.
What changed: compared to last lesson (which only changed the sprite's size), this one changes visibility. The cat is fully there the whole time — only your view of it changes.
The full assembled stack (your reference)
when flag clicked
show
wait (1) seconds
hide
wait (2) seconds
go to x: (100) y: (0)
show
say [Tada!] for (2) seconds
Try It Yourself — three small builds 12 min
Goal: Make the cat blink three times — show, hide, show, hide, show, hide.
when flag clicked
repeat (3)
show
wait (0.3) seconds
hide
wait (0.3) seconds
end
Think: A repeat (3) with show/hide inside = a blink. After the loop ends, the cat is hidden. Try adding a show after the loop to leave the cat visible at the end.
Goal: Make Daniel's cat play "peekaboo" — show, say "Boo!", hide, wait, then come back.
when flag clicked
show
say [Boo!] for (1) seconds
hide
wait (2) seconds
show
say [Found you!] for (2) seconds
Think: The cat says "Boo!", hides for two seconds (suspense!), then pops back saying "Found you!". The audience sees a vanishing and a return — even though only two blocks (hide and show) do all the work.
Goal: Add a second sprite — a heart from the library — and play with layers. The cat goes to the front, then the heart goes to the front, so each one wins.
On the cat sprite:
when flag clicked
go to x: (0) y: (0)
go to front layer
say [I'm in front!] for (2) seconds
On the heart sprite:
when flag clicked
go to x: (0) y: (0)
wait (3) seconds
go to front layer
Think: Both sprites end up at (0, 0). The cat brings itself to the front first and brags. Three seconds later, the heart pushes itself to the front — and the cat is now hidden behind it. Layers, like a stack of cards.
Mini-Challenge — the disappearing-cat trick with a pulse 5 min
"Karthik's Cat performs Houdini"
Make the cat pulse like a heartbeat (from last lesson), then suddenly vanish, wait 2 seconds, and reappear in a new spot — bigger than before — saying "Selamat datang ke KL!" ("Welcome to KL!").
It works if:
- You only used blocks from today's lesson and earlier.
- The cat pulses (grows-shrinks) at least 3 times before vanishing.
- The cat hides for at least 2 seconds before coming back.
- The cat reappears at a different x position and at a bigger size.
- The cat says the welcome message after reappearing.
Reveal one valid solution
One script does the whole sequence — pulse, vanish, move, grow, reappear, greet.
when flag clicked
go to x: (-150) y: (0)
set size to (100) %
show
repeat (3)
change size by (10)
wait (0.1) seconds
change size by (-10)
wait (0.1) seconds
end
hide
wait (2) seconds
go to x: (150) y: (0)
set size to (150) %
show
say [Selamat datang ke KL!] for (2) seconds
That's 14 blocks in one script — over the L1 cap of 8 per stack. To stay under the cap, split this into two scripts: one for "pulse" (under the flag-hat), and one for "vanish-and-return" (under a second flag-hat with a wait (2) seconds at the start, to give the pulse time to run first).
when flag clicked
go to x: (-150) y: (0)
set size to (100) %
show
repeat (3)
change size by (10)
wait (0.1) seconds
change size by (-10)
wait (0.1) seconds
end
when flag clicked
wait (1) seconds
hide
wait (2) seconds
go to x: (150) y: (0)
set size to (150) %
show
say [Selamat datang ke KL!] for (2) seconds
Two scripts, each within the L1 cap. The first pulses; the second hides, teleports, and greets. They run together, but the second one waits long enough for the pulse to finish first.
Recap 2 min
Today you learned to make sprites disappear and reappear with show and hide, and to control which sprite sits in front with go to front layer and go [backward v] (1) layers. These four blocks unlock magic tricks, intro screens, surprises, and tidy multi-sprite scenes.
- show (block)
- A Looks block that makes the sprite visible on the Stage.
- hide (block)
- A Looks block that makes the sprite invisible. The sprite is still there — only your view of it changes.
- Layer
- The stacking order of sprites. The one on top covers any others underneath at the same spot.
- go to front layer (block)
- A Looks block that brings this sprite to the very top of the stack, in front of every other sprite.
Homework 1 min
The KL Tower surprise. Add a "KL Tower" sprite to your project (search the Sprite library for "building", or use any tall sprite you like). Make the cat hide, count down "3, 2, 1!", then make the tower appear with a "Selamat pagi KL!" greeting.
- Open Scratch. Make sure you have the cat sprite. Click "Choose a Sprite" and add any tall sprite (or pick "Buildings" from the library).
- On the cat sprite, build: when ⚑ clicked, show, say [3...] for (1) seconds, say [2...] for (1) seconds, say [1...] for (1) seconds, hide.
- On the tower sprite, build: when ⚑ clicked, hide, wait (3) seconds, show, say [Selamat pagi KL!] for (2) seconds.
- Click the flag. The cat counts down then vanishes; the tower appears just as the cat goes.
Bring back next class:
- A screenshot of both sprites' scripts (one from each sprite).
- Your written answer: "What if you forgot the hide at the start of the tower's script? What would the audience see right when the flag is clicked?"
Heads up for next class: SCR-L01-30 jumps into Backdrops — the background of the Stage. You'll learn how to choose a backdrop from Scratch's huge library (beaches, cities, classrooms) and how it sets the mood for your project.