ุงู†ุชู‚ู„ ู„ู„ู…ุญุชูˆู‰
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 street of houses

Section 11: My Blocks: make a new blockLesson 11.2 ยท โฑ 12 min
๐ŸŽฏ Project goal
A โ€œhouseโ€ block draws a square with a roof on top, then a street of 4 houses in different colours.
๐Ÿงฉ Define โ€œhouseโ€
Blocks: define (house), pen down, repeat (4), pen up, change y by (60), pen down, repeat (3), pen up, change y by (-60)
๐Ÿงฉ The program
Blocks: when ๐Ÿšฉ clicked, erase all, hide, pen up, point in direction (90), go to x: (-210) y: (-80), set pen size to (3), repeat (4)
A street of 4 coloured houses
A street of 4 coloured houses
  1. Start with the square inside define.
  2. Lift the pen and go up 60 to draw the roof.
  3. Go back down to the bottom of the house at the end of define, so the next house starts at the same height.
  4. In the program: repeat 4 times: change the colour, house, move right.

๐Ÿ“Œ Another example: a row of trees

A โ€œtreeโ€ block draws a brown trunk, then a green circle, and Robo goes back to where he was at the end so the next tree is easy to draw.

Blocks: define (tree), set pen color to (orange), point in direction (0), pen down, move (40) steps, pen up, set pen color to (green), point in direction (90), change x by (-15), pen down, repeat (36), pen up, change x by (15), point in direction (180), move (40) steps, point in direction (90)
Blocks: when ๐Ÿšฉ clicked, erase all, hide, point in direction (90), set pen size to (4), go to x: (-180) y: (-80), repeat (4)
Four trees
Four trees
โœ๏ธ Practise
Draw your own street: change the size of the houses, their colours and the gaps between them.
โœ๏ธ Practise here in the lessonor open the lab in a new page โ†—

๐ŸŽฏ Challenge yourself

Easy

Make a โ€œhouse with a doorโ€ block: it uses the โ€œhouseโ€ block itself, then draws a small door. (A block inside a block.)

๐Ÿ‘€ Show the solution
Blocks: define (house), pen down, repeat (4), pen up, change y by (60), pen down, repeat (3), pen up, change y by (-60)
Blocks: define (house with a door), (house), change x by (22), pen down, change y by (25), change x by (16), change y by (-25), pen up, change x by (-38)
Blocks: when ๐Ÿšฉ clicked, erase all, hide, point in direction (90), set pen size to (3), go to x: (-210) y: (-80), repeat (4)
Houses with doors
Houses with doors
Medium

Two streets: a row of 4 houses at the bottom, and a row of 3 blue houses above it.

๐Ÿ‘€ Show the solution
Blocks: define (house), pen down, repeat (4), pen up, change y by (60), pen down, repeat (3), pen up, change y by (-60)
Blocks: when ๐Ÿšฉ clicked, erase all, hide, point in direction (90), set pen size to (3), go to x: (-210) y: (-130), repeat (4), go to x: (-155) y: (10), set pen color to (blue), repeat (3)
The result on the stage
The result on the stage
Hard

A house, then a tree, then a house, then a treeโ€ฆ three times.

๐Ÿ‘€ Show the solution
Blocks: define (house), pen down, repeat (4), pen up, change y by (60), pen down, repeat (3), pen up, change y by (-60)
Blocks: define (tree), set pen color to (orange), point in direction (0), pen down, move (40) steps, pen up, set pen color to (green), point in direction (90), change x by (-15), pen down, repeat (36), pen up, change x by (15), point in direction (180), move (40) steps, point in direction (90)
Blocks: when ๐Ÿšฉ clicked, erase all, hide, point in direction (90), set pen size to (3), go to x: (-220) y: (-80), repeat (3)
The street of houses and trees
The street of houses and trees
Finished the lesson? Mark it so your progress counts.