1.I’m having two problems right now. The first one is that LinearPath isn’t calling the completion function. This is the enemy class with the problem: http://pastebin.com/g814UGEf (I couldn’t get the inline code pasting to work)
I want the function newPath to be called once the entity reaches the destination. I could just do if (currentPath.complete == 1) { newPath(); }
but I feel like I should be able to get this callback function to work.
2.[Solved]The second problem I have, which isn’t as big of a deal, is with my aStar function. I followed the policy almanac tutorial yesterday, and implemented the pathfinding for my entities, but for some reason the entities seem to stop one short on the grid. I’m thinking it might be caused by the origin being the top left of the entity, in which case I’m fine with it. If it’s caused by some other error in a loop somewhere I’d love to find it. Here is the aStar function: http://pastebin.com/WZvQhEXH
update: I figured out my second problem. It was an off by one error. Line 86 of the aStar algorithm should read: for (var j:int = currentPath.pointCount - 1; j > -1; j--)
update2: Check my post below for the solution to my first problem. I was creating a new Tween with a callback function and then assigning it another tween that did not have a callback function set.