How do I use the Pathfinding feature to follow a moving object. So far I have this code but it just crashes my game when I click a monster outside of the basic_attack_radius variable:
FragFather wrote:The pathfinding behavior is very CPU intensive. In your code, you are using a loop inside which you are finding a path. This starts the process of finding a path repeatedly and you will eventually run out of processing power to complete the task so, it is no wonder the game is crashing. Have you read through the documentation and tutorials on pathfinding? If you had, you would see this is not how to use the behavior.
There is a really good tutorial on combining 2 behaviors to get an enemy to chase the player:Read through it. You may find an easy way to do what your are trying to do. Also, make sure to read all the documentation on the pathfinding behavior in the manual and check out a couple other tutorials.
I hope that gets you what you need and good luck with your project.
Users browsing this forum: No registered users and 7 guests