示例#1
0
  public Tower upgradeTo(TowerType t) {
    if (m.getGame().getMoney() >= t.getCost()) {
      m.getGame().setMoney(m.getGame().getMoney() - t.getCost());
      Tower t2 = m.getGame().createTower(t);
      t2.setX(getX());
      t2.setY(getY());
      destroy();
      return t2;
    } else {
      m.getGame().setStatus("Not enough money!");
      m.setNewEvent(
          new Event(m, 2000, 1) {
            public void run(int delta) {
              m.getGame().setStatus("", "Not enough money!");
            }
          });
    }

    return null;
  }
示例#2
0
  public Tower(Main m, int x, int y, TowerType towerType) {
    this.m = m;
    this.towerType = towerType;
    setX(x);
    setY(y);

    setAttackSpeed(0.0D);
    setDamage(0.0D);
    setRange(0.0D);
    setAAcd(0.0D);
    setProjectileAnimationDeath(null);
    setProjectileAnimationStand(null);
    setProjectileAnimationDeathDuration(1);
    setProjectileAnimationStandDuration(1);
    setProjectileSpeed(0.0D);
    setSprite(null);
    setAnimation(ANIMATION_STAND);
    setAnimationTime(0);
    setShootingAir(true);
    setShootingGround(true);
    setBuffs(new ArrayList<Buff>());
  }