Algorithm for waypoint path following?
- by Thierry Savard Saucier
I have a worldmap, with different cities on it. The player can choose a city from a menu, or click on an available cities on the world map, and the toon should walk over there.
I want him to follow a predefined path.
Lets say our hero is on the city 1. He clicks on city 4. I want him to follow the path to city 2 and from there to city 4.
I was handling this easily with arrow movement (left right top bottom) since its a single check.
Now I'm not sure how I should do this. Should I loop threw each possible path and check which one leads me to D the fastest ... and if I do how do I avoid running in circle forever with cities 1-5-2 ?