A* pathfinding in a side-scroller
The A* algorithm is a generic node-graph traversal routine which can be applied to many abstract problems. In a 2D side-scroller, space is traversed in a complex, non-linear fashion. Actors are expected to run across platforms and jump from platform to platform. With some extra math, we can tailor our A* technique to this problem.
The code listed as follows is heavily edited for the sake of brevity. Please refer to the project RecipeCollection03 for full working code of this recipe.
How to do it...
Execute the following code:
/* SSAStarNode */ @implementation SSAStarNode -(float) costToNeighbor:(SSNeighborNode*)nn ...