I am trying to make a maze that uses a ball that the user will drag to try and get to the end of the maze. This is the first time i am trying to make a maze app and I would like to know how to make it so that the ball can’t get through the walls? And what would I use to make the walls? I would really appreciate it!
There are two schools of thought on making mazes:
- Start from an image of a maze as a Canvas background, and have your Ball test pixel by pixel in the direction it is being dragged, like a blind man with a cane
- Store your maze as a two dimensional table of grid locations, coded as clear or blocked, and load it from an AI2 CSV table. Have the drag motion check the immediate neighbor in that direction to see if it is clear or blocked, and move or din't move accordingly.
I like the second approach because it enables you to generate your own mazes programmatically, and it is not as finicky as the first approach, with the danger of skipping past a pixel.
The second approach is scalable to your screen size too.
several things you could do @Ray.Dalt
1, how to make it so that the ball can’t get through the walls?
bounceOffMazeWall.aia (7.8 KB)
what would I use to make the walls?
a scaled png image of a maze placed on the background of a Canvas
Here are some png images of mazes.
Did you try the aia example? it moves a red ball around a partial maze on a Canvas
