Ai flocking algorithm pointers

Hey everyone,

I am in the beginning phase of a top-down Alien Breed clone using gdevelop and I am having some trouble with making the enemies stay a certain distance away from each other when chasing the player character. What is the best way to handle a situation like this?

Here is a screenshot of my events for colliding with each enemy:

Currently I am moving the enemies around using forces and checking a specific radius around the player for each state (attack, chase, wander), but I am open to using the pathfinding behaviour for chasing the player as well.

Let me know how I can improve this. If anyone wants to see the full project to test out what I have so far, I can upload that too.

Hi,
It’s always tricky to have conditions like:
image

In such cases, you should use a custom behavior to make clear which instances you mean.

1 Like

Thanks for that, but I ended up redoing most of the ai code for this and it works now. Much more simple than before. :wink:

1 Like