The problem with such algorithm is that there are lots of ways to apply it.
Making the most common behavior possible, answering all needs will be quite hard. (and tbh is not really my concern. I needed a pathfinder for one of my project. When my own needs are fulfilled, I'll release the behavior. If you have specifics you want to add, you'll then have to add it to the code yourself). (We'll see)
For now, I'll let you with this little demo of the behavior WIP.
The start is the sprite in the top-left corner.
The destination is the bottom right corner.
Click on any case to make it an obstacle. (Avoid making Start and Destination an obstacle though)
When you're done conceiving your maze, click the top-left sprite.
it should show a path of arrows, and give you a message once the sprite has reached the destination square.
As said, really work in progress.
The heuristic formula for this example is Euclidean.
I have more work on this before making it publicly releasable.
This demo is based on the code Ash pointed out.
+ The sprite doesn't move up. Instead it stays in position/stucked.I'll have a look into why later (can be after the r51 release though, as I'm intending to participate ludum dare this week end.
Let's make a bit of promo for C2, join me there (jam rules allows for teams and a 72 hours deadline)
EDIT2 : The PathFinder Behavior topicKyatric2011-09-28 03:43:17