So I'm making a tower defence game and added path finding on my monsters. I'm regenerating the path every time a new tower gets build. and this works. sort off. the problem is that some enemies still ignore the tower.
works as follows, monster is a family
-new tower build sets bool to true.
-when bool is true
-for each monster
-regenerate obstacle map
-find path to
-set bool to false.
now what I'm guessing is happening is that the first monster to find a new path sets the bool to false. making the other monsters follow their original path.
any idea on how to fix this?
Develop games in your browser. Powerful, performant & highly capable.
I think the manual says that when you regenerate the map, it isn't ready until the next tick. so when do the find path action right after the regenerate, it is using the old map...
well that was a quick solve. thanks a lot! Made it search for a path every X seconds and it works perfectly now