1
This commit is contained in:
parent
0a74273831
commit
cd8191e2b1
@ -1,5 +1,7 @@
|
|||||||
#include "precompile.h"
|
#include "precompile.h"
|
||||||
|
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
#include "android.ai.h"
|
#include "android.ai.h"
|
||||||
#include "android.h"
|
#include "android.h"
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
@ -119,6 +121,8 @@ void AndroidAI::DoAttack()
|
|||||||
if (enemy) {
|
if (enemy) {
|
||||||
Human* sender = (Human*)owner;
|
Human* sender = (Human*)owner;
|
||||||
Vector2D shot_dir = enemy->pos - sender->pos;
|
Vector2D shot_dir = enemy->pos - sender->pos;
|
||||||
|
if (std::abs(shot_dir.x) > FLT_EPSILON ||
|
||||||
|
std::abs(shot_dir.y) > FLT_EPSILON) {
|
||||||
shot_dir.Normalize();
|
shot_dir.Normalize();
|
||||||
shot_dir.Rotate((rand() % 10) / 180.0f);
|
shot_dir.Rotate((rand() % 10) / 180.0f);
|
||||||
sender->attack_dir = shot_dir;
|
sender->attack_dir = shot_dir;
|
||||||
@ -126,3 +130,4 @@ void AndroidAI::DoAttack()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user