A Maze to Escape
π― Steer a sprite through a maze you drew yourself. Touching a wall sends you back to the start.
π‘ The idea behind it
A program can sense colour β which is how a game knows you hit something without any collision code.
π§± Blocks you will need
touching colour?go to x: y:foreverif β¦ thenbroadcast
π¨ Build it
- Paint a backdrop: draw the maze walls in one single colour, thick enough to see.
- Shrink your sprite so it fits the corridors β 'set size to 25%' usually works.
- Move it with the four arrow keys, as in the last project.
- Add: forever β if touching colour [the wall colour] β go to x y of the start.
- Draw a green square as the exit, and: if touching colour green β say 'You escaped!' β stop all.
π Make it harder
- Add a timer and show how long the escape took.
- Add a second level by switching the backdrop and moving the sprite back to the start.
π Bugs you will hit
- It always says you are touching the wall: the colour you picked does not exactly match. Use the eyedropper in the colour picker and click the actual wall.
- The sprite slips through walls: it is moving more steps per loop than the wall is thick.
β¬ Need Scratch itself?
Free from MIT, in a browser or as an offline app that needs no connection at all.