- Learnt28 min · the arrow, the 360 rule, a polygon block
- Basic24 min · six shapes from one block
- Challenge 1–327 min · a circle, a house, the same ink
- Extrabonus · a shape dial
Review — the Sketch Pad arc 5 min
pen downdraws as the sprite moves.pen upstops drawing.set pen color to [#ff4fa3]andset pen size to (3)change the line.erase allwipes the Stage.stampprints a copy of the sprite.
Quick-fire
The pen is down. The sprite is at x: 100, y: 0. This runs:
go to x: (0) y: (0)
pen up
go to x: (0) y: (100)
How many lines are on the Stage?
Reveal the answer
One — from (100, 0) to (0, 0). The second move happens with the pen up, so it leaves no line.
Today’s Topic 3 min
- An arrow sprite that draws where it points
- The 360 rule — the turn at each corner is 360 ÷ sides
- A My Block with two inputs:
polygon (sides) (size) :: custom
Learning outcome
By the end of this lesson you will be able to:
- Draw a square with move and turn.
- Work out the turn for any regular shape.
- Make one block that draws a shape with any number of sides.
Learnt — a block that draws any shape 28 min
1 · An arrow that draws
In Sketch Pad you moved the pen with the mouse. Today a script moves it. We use the Arrow1 sprite, because it shows which way it is facing. The next move (10) steps always goes the way the arrow points.
- Add the Arrow1 sprite. Set its size to 45.
point in direction (90)makes it face right.turn cw (90) degreesmakes it face down.
2 · A square, by hand
when flag clicked
erase all
set pen size to (4)
set pen color to [#ff4fa3]
pen up
go to x: (-60) y: (80)
point in direction (90)
pen down
repeat (4)
move (120) steps
turn cw (90) degrees
wait (0.5) seconds
end
How to use this: Click the green flag. Watch the turned box count up by 90 at each corner.
3 · The 360 rule
A sprite that walks all the way round a shape and ends facing the same way has turned once, all the way round. That is 360 degrees. Share it between the corners:
| Shape | Sides | Turn at each corner |
|---|---|---|
| Triangle | 3 | 360 ÷ 3 = 120 |
| Square | 4 | 360 ÷ 4 = 90 |
| Pentagon | 5 | 360 ÷ 5 = 72 |
| Hexagon | 6 | 360 ÷ 6 = 60 |
| Octagon | 8 | 360 ÷ 8 = 45 |
Scratch can do the sum for you. Put an operator in the turn:
turn cw ((360) / (5)) degrees
turn cw ((360) / (sides)) degrees
4 · One block for every shape
- My Blocks → Make a Block.
- Type
polygon. - Click Add an input and name it
sides. - Click Add an input again and name it
size. Click OK. - Build the stack below under the define hat. Drag the orange ovals out of the hat.
define polygon (sides) (size)
repeat (sides)
move (size) steps
turn cw ((360) / (sides)) degrees
wait (0.1) seconds
end
set [sides v] to (5)
set [turn v] to ((360) / (sides))
polygon (sides) (50) :: custom
sides and turn on the Stage for each shape.How to use this: Click the green flag. Four shapes are drawn. Watch the sides and turn boxes change for each one.
Basic — six shapes from one block 24 min
Start a new project.
Step 1 — the board and the arrow
- Click the Stage, then Backdrops → Paint. Fill it with a dark blue.
- Delete the cat. Add Arrow1 and set its size to 45.
- Add the Pen extension from the button at the bottom left.
Step 2 — the block
- Make a Block called
polygonwith two inputs,sidesandsize. - Build the four-block definition from the Learnt.
Step 3 — get ready to draw
when flag clicked, thenerase all.set pen size to (3)and a bright pen colour.pen up,go to x: (-50) y: (110),point in direction (90),pen down.
Step 4 — the ladder
- Make a variable called
sides. Set it to 2. - Add
repeat (6). - Inside:
change [sides v] by (1), thenpolygon (sides) (60) :: custom. - Last inside the loop:
change pen (color v) by (15).
define polygon (sides) (size)
repeat (sides)
move (size) steps
turn cw ((360) / (sides)) degrees
wait (0.1) seconds
end
when flag clicked
erase all
set pen size to (3)
set pen color to [#ffd23f]
pen up
go to x: (-50) y: (110)
point in direction (90)
pen down
set [sides v] to (2)
repeat (6)
change [sides v] by (1)
polygon (sides) (60) :: custom
change pen (color v) by (15)
end
How to use this: Click the green flag. Six shapes grow from the same corner, each a new colour.
My shape does not close up.
Check the turn is ((360) / (sides)) and that it uses the orange sides from the hat.
Lines join my shapes together.
That is fine here — they all start at one corner. If you move to a new place, use pen up first.
Everything appears at once.
The wait (0.1) seconds is missing from inside the repeat in the define hat.
The first shape has 3 sides but the box says 8 at the end.
That is right. The loop adds 1 before each shape, so the last shape drawn is the 8-sided one.
A circle that is not a circle
Scratch has no circle block. Your polygon block can still draw one.
- Use only your polygon block.
- The shape should look round from across the room.
How to use this: Click the green flag and watch the circle drawn one tiny side at a time.
Teacher reveal
polygon (36) (10) :: custom
Thirty-six sides of 10. Any large number of short sides works. Ask: what happens to the size of the circle if you double the sides but keep the size?
A house
A square with a triangle roof. Both come from your polygon block.
- The roof sits on top of the square, not inside it.
- The roof is as wide as the house.
How to use this: Click the green flag. The square is drawn first, then the roof.
Teacher reveal
pen up
go to x: (-60) y: (30)
point in direction (90)
pen down
polygon (4) (120) :: custom
pen up
go to x: (-60) y: (30)
point in direction (30)
pen down
polygon (3) (120) :: custom
The trick is the starting direction. Facing 30, the first side goes up and to the right. Most pupils try 90 first and get a triangle hanging inside the square.
The same amount of ink
Draw eight shapes from one corner. Every shape must use exactly 360 steps of line — no more, no less.
- Use these numbers of sides: 3, 4, 5, 6, 8, 9, 10 and 12. Keep them in a list.
- Show sides and size on the Stage.
- Work out each size with a sum, not by hand.
How to use this: Click the green flag. Watch the size get smaller as the sides go up.
Teacher reveal
set [n v] to (0)
repeat (length of [shapes v])
change [n v] by (1)
set [sides v] to (item (n) of [shapes v])
set [size v] to ((360) / (sides))
pen up
go to x: (-60) y: (105)
point in direction (90)
pen down
polygon (sides) (size) :: custom
change pen (color v) by (10)
end
The numbers in the list all divide 360, so every size is a whole number. Seven and eleven are left out on purpose. Ask a fast pupil what goes wrong with 7.
A shape dial
Turn your project into a toy. The arrow keys change the shape.
- The green flag draws a 5-sided shape.
- The up arrow adds a side and draws again on a clean board. Down takes one away.
- The dial stops at 3 and at 12.
- Every shape fits on the Stage.
How to use this: Click the green flag, then press the up and down arrow keys.
Teacher reveal
define draw it
erase all
set pen size to (4)
set pen color to [#ff4fa3]
change pen (color v) by ((sides) * (8))
pen up
go to x: (-40) y: (100)
point in direction (90)
pen down
polygon (sides) ((420) / (sides)) :: custom
pen up
when [up arrow v] key pressed
if <(sides) < (12)> then
change [sides v] by (1)
draw it :: custom
end
The down key is the mirror: if <(sides) > (3)> then and change [sides v] by (-1).
Summary 5 min
- The arrow draws the way it points. Turn it, then move it.
- Walking all the way round a shape turns you 360 degrees. Each corner turns 360 ÷ sides.
polygon (sides) (size) :: customis four blocks, and it draws every regular shape.- A short wait lets you watch a shape being drawn.
- Regular shape
- A shape whose sides are all the same length and whose corners are all the same.
- Turn
- How far the arrow swings at a corner. For a regular shape it is 360 ÷ sides.
- Input
- A number you give a My Block when you use it, like the sides and the size.
Hand in
Save your project. Next lesson the arrow turns further at every corner — and a pentagon becomes a star.