Example #1
0
  public static boolean canAttack(Tower t, NPC n) {
    if (n.isUntargetable()) return false;
    if (!t.isShootingAir() && n.isFlying()) return false;
    if (!t.isShootingGround() && !n.isFlying()) return false;
    if (getDistance(t.getX(), t.getY(), n.getX(), n.getY())
        > t.getRange() * Main.instance.getGame().getTileWidth()) return false;

    return true;
  }
Example #2
0
 public void copyFromTower(Tower t) {
   setAnimationPreAttack(t.getAnimationPreAttack());
   setAnimationPreAttackDuration(t.getAnimationPreAttackDuration());
   setAnimationPostAttack(t.getAnimationPostAttack());
   setAnimationPostAttackDuration(t.getAnimationPostAttackDuration());
   setAnimationStand(t.getAnimationStand());
   setAnimationStandDuration(t.getAnimationStandDuration());
   setAttackSpeed(t.getAttackSpeed());
   setDamage(t.getDamage());
   setProjectileAnimationDeath(t.getProjectileAnimationDeath());
   setProjectileAnimationStand(t.getProjectileAnimationStand());
   setProjectileAnimationDeathDuration(t.getProjectileAnimationDeathDuration());
   setProjectileAnimationStandDuration(t.getProjectileAnimationStandDuration());
   setProjectileSpeed(t.getProjectileSpeed());
   setRange(t.getRange());
   setShootingAir(t.isShootingAir());
   setShootingGround(t.isShootingGround());
 }