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.