AI beams don't duplicate anymore

This commit is contained in:
bMorgan01 2021-04-28 22:22:33 -06:00
parent 8016bab3e8
commit 0c2a21e4da
2 changed files with 40 additions and 45 deletions

View file

@ -59,9 +59,7 @@ public:
if (status == ATTACKING) {
if (target != nullptr) {
dogFight(getShortestWeaponRange(), target);
shoot(projectiles);
dogFight(getShortestWeaponRange(), target, projectiles);
} else {
status = MOVING;
}
@ -83,7 +81,7 @@ public:
return status;
}
void dogFight(double dist, Ship *target) {
void dogFight(double dist, Ship *target, std::vector<Shootable*> &projectiles) {
destination = target->getPosition();
if (distance(getPosition(), target->getPosition()) > dist) targetVelo = spritePhysics.maxVelocity;
@ -91,6 +89,8 @@ public:
turnTowardsTarget();
approachTargetVelocity();
shoot(projectiles);
}
double getShortestWeaponRange() {