- Learnt28 min · round twice, the star rule, a star block
- Basic24 min · three stars from one block
- Challenge 1–327 min · a sky, six points, the jump rule
- Extrabonus · click to add stars
Review — Lesson 5 5 min
- The arrow draws the way it points.
- Going all the way round a shape is a turn of 360 degrees.
- So each corner turns 360 ÷ sides, and
polygon (sides) (size) :: customdraws any regular shape.
Quick-fire
How far does the arrow turn at each corner of an octagon — a shape with 8 sides?
Reveal the answer
45 degrees. 360 ÷ 8 = 45.
Today’s Topic 3 min
- A star is a shape where the arrow turns further at each corner
- The star rule — turn 180 − (180 ÷ points)
- A
star (points) (size) :: customblock that changes colour as it draws
Learning outcome
By the end of this lesson you will be able to:
- Say why turning 144 instead of 72 turns a pentagon into a star.
- Work out the turn for a star with any odd number of points.
- Make a star block and use it three times.
Learnt — from shapes to stars 28 min
1 · Same moves, bigger turn
Here are two scripts. The only difference is the turn.
repeat (5)
move (100) steps
turn cw (72) degrees
end
repeat (5)
move (160) steps
turn cw (144) degrees
end
How to use this: Click the green flag. The pentagon is drawn first, then the star. Watch the turn box.
2 · The spikiest star
A turn of 180 is a U-turn — the arrow goes straight back the way it came. A turn of nearly 180 sends it back at a sharp angle, and that makes a sharp spike. So the spikiest star turns:
turn cw ((180) - ((180) / (points))) degrees
| Points | Sum | Turn |
|---|---|---|
| 5 | 180 − 36 | 144 |
| 7 | 180 − 25.7 | about 154 |
| 9 | 180 − 20 | 160 |
How to use this: Click the green flag. Three stars are drawn: 5, 7 and 9 points.
3 · A star block
Make it a block, just like the polygon. This one changes colour on every line.
define star (points) (size)
repeat (points)
move (size) steps
turn cw ((180) - ((180) / (points))) degrees
change pen (color v) by (8)
wait (0.08) seconds
end
Basic — three stars from one block 24 min
Open your project from Lesson 5. Keep the board and the arrow.
Step 1 — the star block
- Make a Block called
starwith two inputs,pointsandsize. - Build the six-block definition from the Learnt.
Step 2 — the big star
- Under
when flag clicked:erase all,set pen size to (3), and a pen colour. pen up,go to x: (-75) y: (75),point in direction (90),pen down.star (9) (150) :: custom.
Step 3 — two small stars
- Travel to x: -215, y: -60 and draw
star (5) (70) :: custom. - Travel to x: 145, y: -60 and draw another one.
- Give each star its own starting colour.
when flag clicked
erase all
set pen size to (3)
set pen color to [#ff4fa3]
pen up
go to x: (-75) y: (75)
point in direction (90)
pen down
star (9) (150) :: custom
set pen color to [#ffd23f]
pen up
go to x: (-215) y: (-60)
point in direction (90)
pen down
star (5) (70) :: custom
set pen color to [#4fd1ff]
pen up
go to x: (145) y: (-60)
point in direction (90)
pen down
star (5) (70) :: custom
How to use this: Click the green flag. One big 9-point star, then two small 5-point stars.
My star does not close — it keeps going round.
Check the brackets. It must be 180 take away (180 ÷ points) — put the divide block inside the subtract block, not the other way round.
My star is a single colour.
change pen (color v) by (8) must be inside the repeat, in the define hat.
A line joins two of my stars.
Use pen up before go to x: (0) y: (0), and pen down after it.
A starry sky
Six stars, and a different sky every time you press the flag.
- Each star goes to a random place and has a random size.
- Each star has 5, 7 or 9 points, chosen at random.
- Show the points of the last star on the Stage.
How to use this: Click the green flag, then click it again for a new sky.
Teacher reveal
repeat (6)
set [points v] to (((pick random (2) to (4)) * (2)) + (1))
pen up
go to x: (pick random (-210) to (120)) y: (pick random (-40) to (150))
point in direction (90)
pen down
star (points) (pick random (40) to (80)) :: custom
change pen (color v) by (17)
end
The sum makes 5, 7 or 9 and never an even number. Many pupils try pick random (5) to (9) and get broken stars at 6 and 8 — let them see it.
Six points
The star rule fails for 6. Make a six-point star a different way.
- Use two triangles, each with sides of 150.
- The second triangle is upside down and sits over the first.
- The finished star has six equal points.
How to use this: Click the green flag. The blue triangle is drawn first, then the pink one.
Teacher reveal
pen up
go to x: (-75) y: (43)
point in direction (90)
pen down
polygon (3) (150) :: custom
pen up
go to x: (75) y: (-44)
point in direction (-90)
pen down
polygon (3) (150) :: custom
The second triangle starts 150 to the right and 87 lower, facing left. Pupils often find the start point by trial and error, nudging x and y. That is fine — praise the ones who notice it is the corner of the first triangle’s mirror image.
The jump rule
Imagine the points are dots round a clock face. A star joins each dot to one a few steps further on. That step is the jump. The turn is:
turn cw (((360) * (jump)) / (points)) degrees
- Make a block
jump star (points) (jump) (size) :: custom. - Draw a 7-point star with a jump of 3, and an 8-point star with a jump of 3.
- Show points and jump on the Stage.
How to use this: Click the green flag. A 7-point star, then an 8-point star.
Teacher reveal
define jump star (points) (jump) (size)
repeat (points)
move (size) steps
turn cw (((360) * (jump)) / (points)) degrees
wait (0.1) seconds
end
A jump of 1 is a polygon. A jump of 2 on 5 points is the classic star. If the jump and the points share a factor (8 and 2, 6 and 2) the line closes early — another nice thing for a fast pupil to discover.
Click to add stars
Mix Sketch Pad and today. The mouse chooses where; your block draws the star.
- The green flag clears the board and draws one 7-point star.
- Every click on the Stage adds a new star where you clicked.
- Every new star has 5, 7 or 9 points, a random size and a new colour.
- Old stars stay on the board.
How to use this: Click the green flag, then click anywhere on the Stage to add a star.
Teacher reveal
when stage clicked
pen up
go to x: (mouse x) y: (mouse y)
point in direction (90)
pen down
change pen (color v) by (pick random (10) to (40))
star (((pick random (2) to (4)) * (2)) + (1)) (pick random (40) to (90)) :: custom
pen up
Clicking a sprite does not count as clicking the Stage. If a pupil’s clicks “do nothing”, check they are not clicking on the arrow.
Summary 5 min
- A star is a shape where the arrow goes round more than once.
- The spikiest star turns 180 − (180 ÷ points). It works for odd numbers of points.
- An even number of points needs two shapes, or the jump rule.
- A colour change inside the loop gives every line its own colour.
- Star
- A shape whose lines cross, so each corner is a point.
- U-turn
- A turn of 180 degrees. The arrow faces back the way it came.
- Jump
- How many dots round the circle each line skips to.
Hand in
Save your stars. Next lesson you draw one shape again and again, turning a little each time — and get a flower.