Example #1
0
  public void update(float delta) {

    if (shotDelay > 0) {
      shotDelay -= delta;
    } else if (shotDelay <= 0) {
      shotDelay = 0;
    }

    float distance = ship.getDistanceToTarget();
    if (distance <= 15 && distance > 0 && this.target != null && shotDelay == 0) {
      ship.shootMainGun();
      shotDelay = SHOT_DELAY;
    }
  }