ุงู†ุชู‚ู„ ู„ู„ู…ุญุชูˆู‰
Robo EgyptRobo Egypt
โ˜ฐ Course contents
Robo Block: home
0. Lab tour1
1. Getting started5
2. Motion5
3. Looks and sound5
4. Events4
5. Loops5
6. Conditions and sensing4
7. Variables and randomness4
8. Project: the โ€œCatch Roboโ€ game3
9. Messages: characters talk to each other4
10. Clones: one character, many copies4
11. My Blocks: make a new block3
12. Operators and time4
13. The pro project: a jumping game4

๐Ÿ› ๏ธ Section project: a board of coloured shapes

Section 5: LoopsLesson 5.4 ยท โฑ 15 min

Use loops and the pen to draw a piece of art from shapes turning around one point.

๐ŸŽฏ Project goal
Robo draws 12 squares around the middle, each in a different colour, and a colourful flower appears.
The stage after running the program in Robo Block

Steps

  1. Clear the stage, go to the middle and put the pen down.
  2. Make a square with repeat (4).
  3. Put the square inside repeat (12), and after each square turn 30 degrees (because 360 รท 12 = 30).
  4. Change the pen colour after each square.
๐Ÿงฉ A possible solution
Blocks: when ๐Ÿšฉ clicked, erase all, go to x: (0) y: (0), set pen size to (3), pen down, repeat (12), pen up
๐Ÿ“Œ Note
This is called a loop inside a loop: the inner loop draws a square, and the outer loop repeats the square 12 times.

๐Ÿ“Œ Another example: a five-pointed star

The star has 5 sides, and Robo turns 144 degrees after each side (5 ร— 144 = 720, two full turns).

Blocks: when ๐Ÿšฉ clicked, erase all, go to x: (-75) y: (30), point in direction (90), set pen color to (orange), set pen size to (3), pen down, repeat (5), pen up
The star
The star
โœ๏ธ Practise
Draw your own board: choose a shape, a number and an angle, and change the colours.
โœ๏ธ Practise here in the lessonor open the lab in a new page โ†—

๐ŸŽฏ Challenge yourself

Easy

Swap the square in the board for a triangle: 12 triangles turning 30 degrees.

๐Ÿ‘€ Show the solution
Blocks: when ๐Ÿšฉ clicked, erase all, go to x: (0) y: (0), point in direction (90), pen down, repeat (12), pen up
The result on the stage
The result on the stage
Medium

A rose of 6 hexagons, each turned 60 degrees from the one before.

๐Ÿ‘€ Show the solution
Blocks: when ๐Ÿšฉ clicked, erase all, go to x: (0) y: (0), point in direction (90), set pen color to (blue), pen down, repeat (6), pen up
The result on the stage
The result on the stage
Hard

Two boards: a ring of 8 red squares on the left, and a ring of 8 green triangles on the right.

๐Ÿ‘€ Show the solution
Blocks: when ๐Ÿšฉ clicked, erase all, point in direction (90), go to x: (-120) y: (0), set pen color to (red), pen down, repeat (8), pen up, go to x: (120) y: (0), set pen color to (green), pen down, repeat (8), pen up
The two rings
The two rings
Finished the lesson? Mark it so your progress counts.