int dx = (player.xPos + player.width / 2 ) - ( xPos + width / 2 );
int dy = (player.yPos + player.height / 2 ) - ( yPos + height / 2 );
float length = sqrt((dx * dx) + (dy * dy));
xVel = (dx * 2) / length;
yVel = (dy * 2) / length;
It works fine, but the after chasing the player a while, they all merge together. I get why it happens and have tried fixing it by have collision between the enemies. I know how to check if enemies are colliding, but what I don't know is how to react to it. I don't need an exact description of what to do, but if someone knows how to get the enemies to just kind of be next to each other rather than in the same spot it'd be great. Thanks.