Esempio n. 1
0
  @Override
  public void berserk(Color color) {
    int firedShots = 0;
    for (double angle = 0; angle < 2 * Math.PI; angle += Math.PI / 50) {
      if (!canBerserk()) break;

      addUnit(
          new Bullet(
              this,
              color,
              parent.getFiringOriginX(),
              parent.getFiringOriginY(),
              parent.getDx(),
              parent.getDy(),
              angle));

      if (!isInfiniteAmmo()) --ammo;

      firedShots += 1;
    }

    if (firedShots > 0) {
      timeTillNextBerserk = firedShots * 2;
      Sound.playInternal(SoundLibrary.BERSERK);
    }
  }
Esempio n. 2
0
  @Override
  public void shoot(Color color, double angle) {
    if (!canShoot()) return;

    addUnit(
        new Bullet(
            this,
            color,
            parent.getFiringOriginX(),
            parent.getFiringOriginY(),
            parent.getDx(),
            parent.getDy(),
            angle));

    // This bonus fires two extra bullets at an angle.
    if (getBonusValue(BONUS_THREEWAYSHOT).getValue() == 1) {
      addUnit(
          new Bullet(
              this,
              color,
              parent.getFiringOriginX(),
              parent.getFiringOriginY(),
              parent.getDx(),
              parent.getDy(),
              angle + Math.PI / 8));
      addUnit(
          new Bullet(
              this,
              color,
              parent.getFiringOriginX(),
              parent.getFiringOriginY(),
              parent.getDx(),
              parent.getDy(),
              angle - Math.PI / 8));
    }

    if (!isInfiniteAmmo()) --ammo;

    timeTillNextShot = getBonusValue(BONUS_INTERVALSHOOT).getValue();
    Sound.playInternal(SoundLibrary.BULLET_SHOOT);
  }
Esempio n. 3
0
 public static void init(long localID) {
   if (localPlayerID == -1) localPlayerID = localID;
   Sound.updateMusic();
 }