Learning Goals 3 min
By the end of this lesson you will be able to:
- Use pen down and pen up to make a sprite leave a trail behind it — and to stop leaving one.
- Wipe the Stage clean with erase all at the start of every drawing, so old marks don't pile up.
- Recognise the standard drawing pattern: green flag → erase all → go to start → pen down → move → pen up, and tell which block belongs in which spot.
Warm-Up — the invisible artist 7 min
In SCR-L04-06 you added the Pen extension to your block palette. A new dark-green category appeared on the left. Today we actually use it.
Here's the smallest sprite-moves script you've written a hundred times:
when flag clicked
go to x: (-200) y: (0)
move (300) steps
Click the flag (mentally). What do you see on the Stage after the cat finishes moving?
Reveal the answer
You see the cat at the right side of the Stage — and nothing else. The cat travelled across the screen, but it left no record of where it had been. The journey is invisible the moment it's over.
This is the gap that the Pen extension fills. With one extra block, the cat becomes a pencil — and the path it walks turns into a line you can actually see.
Today's question: how do we turn that invisible journey into a drawing?
New Concept — the sprite as a pen 15 min
Imagine the cat is holding a marker. Most of the time the marker is lifted off the paper, so nothing gets drawn. When you lower the marker, every step the cat takes leaves a coloured line behind it. When you lift the marker again, the cat keeps moving but stops drawing.
That's the whole mental model. Three blocks do all the work.
Pen down — start drawing
From the dark-green Pen palette:
pen down
It's a one-shot block — it doesn't draw anything on its own. It just switches the pen on. The next move () steps or go to x: () y: () will leave a trail.
Pen up — stop drawing
pen up
Use this when you want the cat to travel to a new place without dragging a line behind it — for example, between two separate shapes.
Erase all — wipe the Stage
erase all
This is almost always the first block in a drawing project. Without it, every time you click the green flag, new lines pile on top of old lines until the Stage looks like spaghetti.
The standard drawing pattern
Nearly every Pen project you'll build for the next ten lessons follows this exact order:
when flag clicked
erase all
go to x: (-200) y: (0)
pen down
move (300) steps
pen up
Run it. The Stage is wiped, the cat jumps to the left, the pen drops, the cat slides 300 steps right while drawing a straight line, and the pen lifts. You've drawn a horizontal line across the Stage.
Worked Example — the cat draws a line 12 min
Open Scratch. Make sure the Pen extension is already added (the dark-green category should be visible on the left). We'll build the horizontal-line drawing in eight steps.
Step 1 — Start fresh
New project. Default cat sprite. Click the Stage and drag the cat roughly to the centre so we can see it move.
Step 2 — Drop the hat
From Events: when ⚑ clicked. This is the start of every drawing script.
Step 3 — Wipe the Stage first
From Pen: erase all. Snap it under the hat. Every drawing starts with a clean slate.
Step 4 — Jump to the start position
From Motion: go to x: (-200) y: (0). The Stage runs from x: −240 to x: +240, so −200 puts us comfortably on the left.
Step 5 — Drop the pen
From Pen: pen down. From this point on, the cat will draw whatever it does.
Step 6 — Move and watch the line appear
From Motion: move (300) steps. The cat glides right and leaves a thin coloured line behind it. Click the flag — you should see the line stretch across the Stage in one quick movement.
Step 7 — Lift the pen at the end
From Pen: pen up. The drawing is done. We lift the pen now so that if we add more code later — like a victory dance — the cat doesn't keep drawing during it.
Step 8 — Click the flag again to test erase-all
Click the green flag a second time. Notice that the old line vanishes the instant the script restarts, then the new line is drawn fresh. That's erase all doing its job. Try deleting that block, clicking the flag four or five times, and watch the lines pile up — then put it back.
The full assembled stack
when flag clicked
erase all
go to x: (-200) y: (0)
pen down
move (300) steps
pen up
What you just built: the sprite is no longer just a character that walks — it's a pencil that records its journey. Once you can draw a straight line, you can draw a square, a circle, a star, a flower, or a Deepavali kolam. They're all just more clever ways of moving a pencil.
Try It Yourself — three pen drills 15 min
Goal: Draw a vertical line down the middle of the Stage. Start at the top (x: 0, y: 150), pen down, and end at the bottom (x: 0, y: −150).
when flag clicked
erase all
go to x: (0) y: (150)
pen down
go to x: (0) y: (-150)
pen up
Think: Two go-to blocks and a pen-down in between. The first go-to jumps (no drawing yet because the pen is still up from last time and we wipe first), the second go-to slides while drawing.
Goal: Draw two separate horizontal lines — one near the top of the Stage (y: 100) and one near the bottom (y: −100). The trick: when the cat finishes the top line and travels down to the bottom, it must not draw a connecting line.
when flag clicked
erase all
go to x: (-200) y: (100)
pen down
move (400) steps
pen up
go to x: (-200) y: (-100)
pen down
move (400) steps
pen up
Think: If you forget the pen up before the second go to x: () y: (), Scratch will draw a long diagonal connecting the two lines. The pen does not care that you've "finished" — it draws whenever something moves. You have to lift it.
Goal: Draw a staircase — three steps going up. Each step is a horizontal segment (50 steps right) followed by a vertical jump (30 up). Use change x by () and change y by () instead of go-to.
when flag clicked
erase all
go to x: (-100) y: (-50)
pen down
change x by (50)
change y by (30)
change x by (50)
change y by (30)
change x by (50)
change y by (30)
pen up
Think: Notice we never lift the pen in the middle — the staircase is meant to be a single connected drawing. change x by () moves relative to where the sprite already is, which is perfect for "go right a bit, then up a bit" patterns. SCR-L04-09 will replace this whole stack with one repeat (3).
Mini-Challenge — the disappearing drawing 5 min
"Mei Lin's vanishing line"
Mei Lin wants the cat to draw a horizontal line, wait two seconds so her little brother can see it, and then wipe the Stage clean. She writes this:
when flag clicked
go to x: (-200) y: (0)
pen down
move (300) steps
pen up
erase all
wait (2) seconds
She clicks the flag. The line flashes onto the Stage and is gone instantly. Her little brother sees nothing. And on the second click, an extra mark appears in the corner. What did Mei Lin get wrong?
Reveal one valid solution
Two bugs, one fix each.
Bug 1: the wait is in the wrong place. Mei Lin wipes the Stage before waiting, so the line is erased the very moment it's drawn. The wait has to come between drawing and erasing — that's the whole pause-so-people-can-look-at-it moment.
Bug 2: erase-all is missing from the top. The very first time you click the flag, the Stage starts clean (Scratch wipes it on every project load), so everything looks fine. But every time after that, the old line is still there from the previous click, and the new line is drawn on top — until the erase-all at the bottom of the script runs. The result is a flickering double-line. Erase-all belongs at the start of every drawing.
when flag clicked
erase all
go to x: (-200) y: (0)
pen down
move (300) steps
pen up
wait (2) seconds
erase all
Same eight blocks. Two of them swapped positions. The lesson: erase-all goes at the start, waits go between drawing and the next visible change.
Recap 3 min
You met the three blocks that turn a sprite into a pen. pen down drops the marker so motion starts drawing; pen up lifts it so the cat can travel silently; erase all wipes the Stage clean and almost always lives right after the when ⚑ clicked hat. The standard pattern — flag, erase, position, pen down, draw, pen up — is the skeleton of every drawing in this cluster.
- Pen
- An extension added in SCR-L04-06 that gives a sprite a virtual marker. The sprite leaves a coloured trail wherever it moves while the pen is down.
- Pen down
- pen down — switches the sprite's marker on. The next motion block will draw a line.
- Pen up
- pen up — switches the sprite's marker off. The sprite still moves, but no new marks appear.
- Erase all
- erase all — clears every pen mark currently on the Stage. Does not affect the sprite itself.
- Stroke
- One continuous line drawn while the pen is down. Lifting the pen ends the stroke; dropping it again starts a new one.
Homework 2 min
The Plus-Sign Drill. Draw a large plus sign (+) in the centre of the Stage — one horizontal line and one vertical line that cross at the middle. You'll need both pen down and pen up to do it cleanly.
- Start with when ⚑ clicked and erase all.
- go to x: (-150) y: (0), then pen down, then go to x: (150) y: (0) to draw the horizontal stroke.
- pen up (so the next jump doesn't leave a line), then go to x: (0) y: (150).
- pen down again, then go to x: (0) y: (-150) for the vertical stroke.
- pen up at the end.
Save as HW-L4-07-Plus-Sign.sb3. Click the flag. You should see a clean plus, no diagonal lines, no leftovers from previous runs.
Bring back next class:
- The
.sb3file. - Your answer to: "What happens if you swap the order of pen up and the second go to x: () y: ()? Try it and describe what you see."
Heads up for next class: SCR-L04-08 meets set pen color to () and set pen size to (). The plus you just drew is a thin blue line — by next class you'll be drawing thick rainbow ones.