T
tbourget1
Guest
So I am creating code for a game where there are 4 players, and the enemy needs to path its way to one of them. The code is working with one player, but once other players are added all of the enemies will still only follow player 1. I created an array path[] to store the 1-4 path(s). So I have all 4 paths in an array, and I also have all 4 path distances in an array called path_distance[] (calculated using path_get_length). How do I get the enemy started on the shortest path? Is there a basic coding function that I could be using?
I also have the shortest path distance stored in a variable shortest_distance (which was calculated using min( path_distance[1]...path_distance[4] ) ), but I'm not sure how to derive the path from the distance.
I also have the shortest path distance stored in a variable shortest_distance (which was calculated using min( path_distance[1]...path_distance[4] ) ), but I'm not sure how to derive the path from the distance.