Page 1 of 1

following a path

Posted: Wed Aug 06, 2008 9:36 pm
by farvardin
I'm trying to create a remake of the old game Amidar, only the bonus sequence at the moment.

I've made the board, and I'd like to know if there is an easy way with Löve to follow a path or a set of lines created with the love.graphics.line function. There is an object with should follow the line, and each time it meets a crossroad it must follow it.

Re: following a path

Posted: Thu Aug 07, 2008 2:49 am
by Xfcn
I was going to suggest you look into translating A* path-finding algorithm but you might find that to be a bit too much for what you're after.

Re: following a path

Posted: Thu Aug 07, 2008 5:25 am
by farvardin
I don't think I'm skilled enough for using this. The paths are already made, I will start the object in one direction, and when it reaches a crossing line, it should change direction. I think the future collision detection module may do the job?

Re: following a path

Posted: Thu Aug 07, 2008 11:01 am
by mike
I was going to suggest A* myself, but it seems like an over-complicated method of doing it since the paths are very simple. My best suggestion is to create some sort of metaphysical representation of the whole world (like a 2D array with boolean values) where you then designate what is a path and what isn't, letting the creatures traverse the path that way. I wonder if the collision detection would be able to handle following an object this way...

Re: following a path

Posted: Thu Aug 07, 2008 9:22 pm
by farvardin
I've found this article which seems to be understandable even by a noob like me:
http://www.policyalmanac.org/games/aStarTutorial.htm

but I think I'll try a simpler method for this kind of simple project.