๐ ๏ธ 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
- Draw the backdrop: black walls, and a green square at the end.
- Make Robo smaller so he fits between the walls.
- Put the arrow-movement script inside forever and if.
- Add an if for black and an if for green.

๐ 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.)






โ๏ธ Practise
Build your own maze: draw the backdrop in black and green, and move Robo with the arrows.
โ๏ธ Practise here in the lessonโ Close the labor 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๐ Hide the solution


Medium
If Robo gets to x greater than 170 he says โI won! ๐โ and the game stops (stop all).
๐ Show the solution๐ Hide the solution


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๐ Hide the solution






