ุงู†ุชู‚ู„ ู„ู„ู…ุญุชูˆู‰
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: the maze

Section 6: Conditions and sensingLesson 6.3 ยท โฑ 15 min

Draw a maze on the backdrop with black lines, and make Robo walk through it with the arrows. If he touches a wall he goes back to the start.

๐ŸŽฏ Project goal
Robo moves with the arrows inside the maze. If he touches black he says Oops! and goes back to the start, and if he reaches green he says I won!

Steps

  1. Draw the backdrop: black walls, and a green square at the end.
  2. Make Robo smaller so he fits between the walls.
  3. Put the arrow-movement script inside forever and if.
  4. Add an if for black and an if for green.
๐Ÿงฉ A possible solution
Blocks: when ๐Ÿšฉ clicked, set size to (30) %, go to x: (-200) y: (-150), forever
๐Ÿ“Œ Note
Finish the up and down arrows yourself in the same way.

๐Ÿ“Œ Another example: a guard on the road

A dog walks up and down. The dog itself asks: am I touching Robo? If yes, it sends the message โ€œcaughtโ€, and Robo goes back to the start. (Messages are in section 9.)

๐Ÿงฉ ๐Ÿค– Robo
Blocks: when ๐Ÿšฉ clicked, go to x: (-180) y: (0), set size to (60) %, forever
๐Ÿงฉ ๐Ÿค– Robo
Blocks: when I receive (caught), say (Oh! ๐Ÿ˜ต) for (1) seconds, go to x: (-180) y: (0)
๐Ÿงฉ ๐Ÿถ Dog
Blocks: when ๐Ÿšฉ clicked, set size to (60) %, go to x: (0) y: (100), forever
๐Ÿงฉ ๐Ÿถ Dog
Blocks: when ๐Ÿšฉ clicked, forever
Robo and the guard
Robo and the guard
Robo tries to get past
Robo tries to get past
โœ๏ธ Practise
Build your own maze: draw the backdrop in black and green, and move Robo with the arrows.
โœ๏ธ Practise here in the lessonor open the lab in a new page โ†—

๐ŸŽฏ Challenge yourself

Easy

Add the up and down arrows in the same way (key pressed inside forever).

๐Ÿ‘€ Show the solution
Blocks: when ๐Ÿšฉ clicked, go to x: (0) y: (0), forever
The result on the stage
The result on the stage
Medium

If Robo gets to x greater than 170 he says โ€œI won! ๐Ÿ†โ€ and the game stops (stop all).

๐Ÿ‘€ Show the solution
Blocks: when ๐Ÿšฉ clicked, go to x: (-180) y: (0), forever
He reached the end and the game stopped
He reached the end and the game stopped
Hard

Robo has 3 tries (a variable lives). Every time the dog catches him one is lost, and when it reaches 0 the game ends. (Variables are in section 7.)

๐Ÿ‘€ Show the solution
๐Ÿงฉ ๐Ÿค– Robo
Blocks: when ๐Ÿšฉ clicked, go to x: (-180) y: (0), set size to (60) %, set (lives) to (3), forever
๐Ÿงฉ ๐Ÿค– Robo
Blocks: when I receive (caught), change (lives) by (-1), go to x: (-180) y: (0), if <(lives = 0)> then
๐Ÿงฉ ๐Ÿถ Dog
Blocks: when ๐Ÿšฉ clicked, set size to (60) %, go to x: (0) y: (40), forever
๐Ÿงฉ ๐Ÿถ Dog
Blocks: when ๐Ÿšฉ clicked, forever
Tries went down
Tries went down
Finished the lesson? Mark it so your progress counts.