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