Beispiel #1
0
  @Override
  public void update() {
    rotationSpeedZ.update();
    rotationY.update();
    rotYShakeAmplitude.update();

    // rotationSpeedZ.setTarget(0, 2f);

    rotationSpeed = rotationSpeedZ.get();

    super.update();
    elapsed += Timer.delta;
    scriptInterpreter.updateRunScript();

    // rotZ  = 30f;
    rotY =
        rotationY.get()
            + MathUtil.getCyclicValue(
                -rotYShakeAmplitude.get(), rotYShakeAmplitude.get(), 2f * elapsed);

    if (rotY > 45) {
      width = 25;
      height = 40;
    } else {
      width = height = 40;
    }
    this.bakeDimensions();
  }
Beispiel #2
0
  @Override
  public void receiveDamageFrom(Entity entity, int amount) {

    if (entity.entityType == EntityType.PLAYER) {
      return;
    }

    if (entity.entityType == EntityType.PLAYER_SPECIAL_WEAPON) {
      if (amount > 0) {
        amount = 1000;
        entity.attackPower = 0;
      }
    }

    if (reflectAttack && amount > 0) {
      float hitX = entity.posX;
      float hitY = entity.posY + 20;
      Player player = Engine.player;
      float directionAngle =
          MathUtil.radiansToDegrees
              * MathUtil.getAngleBetween(hitX, hitY, 0f, player.posX, player.posY);

      for (int i = 0; i < 3; i++) {
        Bullet bullet = ShotB.newInstance();
        bullet.registerInLayer();
        bullet.posX = hitX;
        bullet.posY = hitY;
        float modif = 0;
        if (i == 1) modif = -20;
        if (i == 2) modif = 20;
        bullet.setDirAngle(directionAngle + modif);
        bullet.moveSpeed = 150f;
      }
      return;
    }

    if (amount > 0) {
      super.receiveDamageFrom(entity, amount);
      UI.setBossLifeAmount((float) lifeRemaining / lifeStart);
    }
  }