It looks like you're new here. If you want to get involved, click one of these buttons!
I am making a game that involves tilting a ball through a randomly generated maze. I retrieved some code that randomly generates a maze from Wildbill from http://codea.io/talk/discussion/1275/open-the-maze/p1. I added a ball that can be tilted through the maze and I have enabled touch detection on the outer edges of the maze so that the ball cannot pass through. My problem is that I cannot seem to figure out how to detect when the ball is touching the lines inside the maze, so that the ball will not simply pass through each line. Does anyone know how to get the ball to not pass through the lines of the maze with the code I am currently using or with any other code that can randomly generate a maze and can allow a ball to be tilted through? Any help would be much appreciated.
Thanks,
Chris
Comments
@ChrisKarpinski The easiest way is to use physics.body with EDGE. EDGE would be used to draw all the lines. Then let the physics engine do all the collision testing. I already did what you're trying to do using physics.body and it's posted somewhere in this forum. I'll try to find it and post the link.
Depending on the size of the maze, you could use physics. I can't run the code right now, or I would give a better answer. But I think physics is probably your most viable option.
@ChrisKarpinski Here's the code that I added physics.body to. I did it in August 2013. It looks like we started out with the same code.
Funny ... I was experimenting with the exact same thing. What I did was make all walls inside physicsbodies as well and that works for me!
Thanks so much for the code Dave, my maze works perfectly now and now I've learned a thing or two about using physics in Codea. Big thanks to everyone else for the ideas and the help!