private void HandleDeathAnimation(GameTime gameTime)
        {
            if (marioMovement != MarioMovement.Die)
            {
                return;
            }

            deathAnimTimeRemaining -= (float)gameTime.ElapsedGameTime.TotalSeconds;
            float move = deathAnimSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;

            //Move up from 5%-15%
            if (deathAnimTimeRemaining < 0.9167f * deathAnimLength && deathAnimTimeRemaining >= 0.74999f * deathAnimLength)
            {
                mario.ForceMove(0, -move);
            }
            //Then move down from 30%-100%
            else if (deathAnimTimeRemaining < 0.74999f * deathAnimLength)
            {
                mario.ForceMove(0, move);
            }

            //When we finish animation, reset level.
            if (deathAnimTimeRemaining <= ZERO)
            {
                MarioEvents.Reset(this, EventArgs.Empty);
                MarioGame.Instance.TriggerDeathSequence();
            }
        }
Example #2
0
 private void DisplayDeathScreen()
 {
     if (levelHUD != null)
     {
         levelHUD.Draw(spriteBatch, font, deathScreen, false);
     }
     if (deathScreenTimer < deathScreenCount)
     {
         deathScreenTimer++;
     }
     else
     {
         if (!gameComplete)
         {
             deathScreenTimer = Zero;
             deathScreen      = false;
             MarioEvents.Reset(null, null);
         }
     }
 }
 public void Pause()
 {
     MarioEvents.Pause(this, EventArgs.Empty);
 }
 public void P1_MoveLeft()
 {
     MarioEvents.P1_MoveLeft(this, EventArgs.Empty);
 }
 public void Quit()
 {
     MarioEvents.Quit(this, EventArgs.Empty);
 }
 public void Reset()
 {
     MarioEvents.Reset(this, EventArgs.Empty);
     Score.Lives = 3;
 }
 private void SelectLevel2()
 {
     MarioEvents.SelectLevel(this, EventArgs.Empty, 1);
 }
 public void P2_ShootFire()
 {
     MarioEvents.P2_ShootFire(this, EventArgs.Empty);
 }
 public void P2_Crouch()
 {
     MarioEvents.P2_Crouch(this, EventArgs.Empty);
 }
 public void P2_Jump()
 {
     MarioEvents.P2_Jump(this, EventArgs.Empty);
 }
 public void P2_MoveRight()
 {
     MarioEvents.P2_MoveRight(this, EventArgs.Empty);
 }