[NOT a Bug] Destroy Obj when tween finish doesn't works

The pathfinder uses a lot of resources to calculate a path. It should be used sparingly especially if there are a lot of enemies and obstacles to avoid.

This post might help. It discusses using a timer in combination with a distance check. When the enemy is far away then you can probably update the path (meaning using move to action) less frequently. With a long path, most of the path will be the same. It’s only the last part that changes. It’s more efficient to update less frequently when far away.

When the enemy is close then you update the path more often. It doesn’t take long to update a short path compared to a longer path with obstacles. If you don’t update frequently enough , the enemy would target old positions and create a lag.

https://forum.gdevelop.io/t/pathfinding-not-recalculating-and-passing-through-obstacles/51567/8?u=keith_1357

1 Like