I am making a puzzle game that needs some way to direct the selected units to their destination. This is my first case involving any way to find the path, so I chose the aStar method, which was the easiest for me. (thanks to this wonderful page http://www.policyalmanac.org/games/aStarTutorial.htm ). I came quite far, farther than I expected, but there are still some minor issues.
I could write a long explanation that no one would understand, but instead I uploaded my Flash project so you can see: http://www.martinowullems.com/pigsplode/pigsplode%20flash.html
Select the pig, and then select the second tile to make it walk (not the bottom tiles, they are bugged: P). Dark tiles are unusable. Red tiles are those that belong to the generated path. I seem to be on the right track, I feel like I'm making a little mistake. I felt something was wrong with choosing the best node function (findNextNode).
I looked at the code for too long and made no progress. I tried to look at the implementation of other people, but it is always difficult for me to understand how other people work.
Any help would be greatly appreciated, I want to go to the project!
I made wonderfl version so you can check and play with the code: http://wonderfl.net/c/hRtO
source share