Пример #1
0
 public void startTeleport(float xx, float yy) {
   if ((m_inTeleport == false) && (m_dying == false)) {
     m_teleportAnimation = new AnimateMoveTo(1.5f, this.getX(), this.getY(), xx, yy);
     m_inTeleport = true;
     m_teleportState = 0;
     this.stopSound("buggyDrive");
     this.stopAllAnimations();
     m_invincibleAnimation.stop();
     m_dx = 0;
     m_dy = 0;
     this.runAnimation(m_teleportOut);
     this.playSound("teleportIn", 0.75f);
   }
 }
Пример #2
0
 public void dieNow() {
   Gdx.app.debug("BuggySprite", "dieNow called");
   if ((m_dying == false) && (m_alive)) {
     Gdx.app.debug("BuggyrSprite", "dying!!!!");
     this.playSound("vaporize", 0.8f);
     m_inHit = false;
     m_ignoreHits = 0;
     m_explodeDeath = true;
     m_energy = 0;
     this.stopAllAnimations();
     m_invincibleAnimation.stop();
     this.stopSound("buggyDrive");
     PooledEffect effect = m_gameLayer.bombEffectPool.obtain();
     effect.setPosition(this.getX() + this.getWidth() / 2, this.getY());
     m_gameLayer.addParticleEffect(effect);
     this.runAnimation(m_throughDoorAnimation);
     m_dying = true;
     m_deadState = 1;
     if (m_focus == false) {
       m_gameLayer.buggyDieWithoutFocus();
     }
   }
 }
Пример #3
0
  @Override
  public void update(float deltaTime) {

    if (m_pause) return;

    if ((m_energy != 1) && (m_heartbeatSoundId > 0)) {
      this.stopSound("heartbeat");
      m_heartbeatSoundId = -1;
    }

    if (m_levelEnding) {
      if (m_heartbeatSoundId > 0) {
        this.stopSound("heartbeat");
        m_heartbeatSoundId = -1;
      }

      if (m_levelEndingFading == false) {
        this.translate(m_dx, m_dy);
        float deltaX = Math.abs(m_machineX - this.getX());
        float deltaY = Math.abs(m_machineY - this.getY());
        if ((deltaX < 15) && (deltaY < 15)) {
          m_levelEndingFading = true;
          this.runAnimation(m_levelEndingAnimation);
        }
      } else {
        if (m_levelEndingAnimation.isRunning() == false) {
          this.setVisible(false);
          m_alive = false;
        }
      }
    } else if (m_spawning) {
      if (!m_spawnAnimation.isRunning()) {
        m_spawning = false;
      }
    } else if (m_dying == false) {
      if (m_energy == 1) {
        if (m_heartbeatSoundId < 0) {
          m_heartbeatSoundId = this.loopSound("heartbeat", 0.25f);
        }
      }

      float ex = 0;
      if (m_activePlatform != null) {
        ex = m_activePlatform.getDX();
      }

      if (m_pauseMoveTicks > 0) m_pauseMoveTicks--;

      if (m_inTeleport) {
        if (m_teleportState == 0) {
          if (m_teleportOut.isRunning() == false) {
            m_teleportState = 1;
            this.runAnimation(m_teleportAnimation);
            this.playSound("teleport", 0.75f);
          }
        } else if (m_teleportState == 1) {
          if (m_teleportAnimation.isRunning() == false) {
            m_teleportState = 2;
            this.runAnimation(m_teleportIn);
            this.playSound("teleportOut", 0.75f);
          }
        } else if (m_teleportState == 2) {
          if (m_teleportIn.isRunning() == false) {
            m_teleportState = 0;
            m_inTeleport = false;
            m_pauseMoveTicks = 0;
          }
        }
      } else if (m_pauseMoveTicks < 1) {
        this.move();
        this.translate(m_dx + ex, m_dy);
        if ((m_dx != 0) || (m_dy != 0)) {
          lastMoveX = m_dx;
          lastMoveY = m_dy;
        }
      }
    } else if (m_dying == true) {
      if (m_deadState == 1) {

        if (m_deathAnimation.isRunning() == false) {
          pLight.setActive(false);
          m_deadState = 2;
          if (m_explodeDeath) {
            m_climbing = false;
            m_explodeDeath = false;
            m_deadState = 3;
            m_deadTicks = 0;
            m_dx = 0;
            m_dy = 0;
          } else {
            m_climbing = false;
            m_dy = 0;
            this.accelerate(0, 26f);
            maxFallVelocity = 128.0f;
            m_deadTicks = 0;
            m_dx = 0;
            this.playSound("falling", 0.9f);
          }
        }
      } else if (m_deadState == 2) {
        m_deadTicks++;
        this.accelerate(0, -(m_gravity * 1.5f));
        this.translate(m_dx, m_dy);
        if (m_deadTicks > 90) {
          m_alive = false;
          m_deadState = 1;
          m_dying = false;
          m_explodeDeath = false;
        }
      } else if (m_deadState == 3) {
        m_deadTicks++;
        if (m_deadTicks > 130) {
          m_alive = false;
          m_deadState = 1;
          m_dying = false;
          m_explodeDeath = false;
        }
      }
    }
  }
Пример #4
0
  public BuggySprite(
      TextureAtlas myTextures,
      TiledMapTileLayer pTiles,
      TiledMapTileLayer lTiles,
      ArrayList<PlatformSprite> platforms,
      GameInputManager inputManager,
      int lives,
      World world,
      MainGameLayer gameLayer) {

    super(myTextures.findRegion("buggy_F1"), pTiles, lTiles);
    standRegion = myTextures.findRegion("buggy_F1");
    m_walkAnimation =
        new AnimateSpriteFrame(myTextures, new String[] {"buggy_F1", "buggy_F2"}, 0.3f, -1);
    m_standAnimation = new AnimateSpriteFrame(myTextures, new String[] {"buggy_F1"}, 1.0f, -1);

    m_attackAnimation = new AnimateSpriteFrame(myTextures, new String[] {"man_stand_F1"}, 0.3f, 1);

    m_hitAnimation = null;
    m_tutorialAnimation = new AnimateSpriteFrame(myTextures, new String[] {"buggy_F1"}, 0.5f, -1);
    m_idleAnimation = new AnimateSpriteFrame(myTextures, new String[] {"buggy_F1"}, 0.5f, -1);

    m_throughDoorAnimation = new AnimateFadeOut(0.5f);
    m_floatAnimation =
        new AnimateSpriteFrame(myTextures, new String[] {"man_jump_F3", "man_jump_F3"}, 0.65f, -1);

    m_teleportIn = new AnimateFadeIn(0.35f);
    m_teleportOut = new AnimateFadeOut(0.35f);

    AnimateTranslateVertical f1 = new AnimateTranslateVertical(1.0f, 0f, -3f, 1);
    AnimateTranslateVertical f2 = new AnimateTranslateVertical(3.0f, 1.0f, -1f, 1);
    GameAnimateable[] af = {f1, f2};

    m_floatAnimation2 = new GameAnimationSequence(af, -1);

    AnimateFade fo = new AnimateFade(0.2f, 0.9f, 0.2f);
    AnimateDelay delay = new AnimateDelay(0.25f);
    AnimateFade fi = new AnimateFade(0.2f, 0.2f, 0.9f);
    AnimateFade ff = new AnimateFade(0.25f, 0.2f, 1.0f);
    GameAnimateable[] a = {fo, fi, delay, fo, fi, delay, fo, ff};

    m_invincibleAnimation = new GameAnimationSequence(a, 1);
    m_invincibleAnimation.setIgnoreStop(true);

    m_inputManager = inputManager;
    m_platforms = platforms;

    m_activeWeapon = null;

    maxSpeedX = 6.0f;
    defaultMaxSpeedX = 6.0f;
    maxSpeedY = 4.0f;
    maxFallVelocity = 20.0f;
    m_horizontalDragFactor = 1.0f;
    m_climbingDragFactor = 0.25f;
    m_gravity = 0.8f;

    m_jumping = false;
    m_climbing = false;
    m_currDir = 1;

    m_lives = lives;
    m_boundingBox.width = this.getBoundingRectangle().width / 4;
    m_boundOffX = this.getBoundingRectangle().width / 2;
    m_boundingBox.height = this.getBoundingRectangle().height / 5;

    m_gameLayer = gameLayer;

    this.runAnimation(m_standAnimation);

    if (gameLayer.m_stage > 1)
      pLight = gameLayer.createConeLight(new Color(0.8f, 0.8f, 0.5f, 0.75f), 1100, 0, 0, 0, 25);
    else pLight = gameLayer.createConeLight(new Color(0.8f, 0.8f, 0.5f, 0.35f), 700, 0, 0, 0, 25);

    pLight.setXray(true);
    pLight.setActive(false);
    m_lightX = this.getWidth() - 20;
  }