Prevented AI craft for jittering when close to leader.

This commit is contained in:
Steve 2016-02-25 10:55:15 +00:00
parent 1476c69944
commit 19630696c5
1 changed files with 2 additions and 2 deletions

View File

@ -594,7 +594,7 @@ static void moveToPlayer(void)
if (dist <= 350) if (dist <= 350)
{ {
if (player->dx != 0 || player->dy != 0) if (fabs(player->dx) >= 1 && fabs(player->dy) >= 1)
{ {
wantedAngle = getAngle(player->x, player->y, player->x + (player->dx * 10), player->y + (player->dy * 10)); wantedAngle = getAngle(player->x, player->y, player->x + (player->dx * 10), player->y + (player->dy * 10));
@ -790,7 +790,7 @@ static void moveToLeader(void)
if (dist <= 350) if (dist <= 350)
{ {
if (self->leader->dx != 0 || self->leader->dy != 0) if (fabs(self->leader->dx) >= 1 && fabs(self->leader->dy) >= 1)
{ {
wantedAngle = getAngle(self->leader->x, self->leader->y, self->leader->x + (self->leader->dx * 10), self->leader->y + (self->leader->dy * 10)); wantedAngle = getAngle(self->leader->x, self->leader->y, self->leader->x + (self->leader->dx * 10), self->leader->y + (self->leader->dy * 10));