private void MenuPrev()
 {
     if (menuNum > 0)
     {
         menuNum--;
         menu_sound.PlaySound();
     }
 }
 public void OnCollision()
 {
     powerup_sound.PlaySound();
     Respawn();
     setTimer = true;
     isMoving = false;
 }
        private float DoJump(float velocityY)
        {
            if (IsJumping)
            {
                if ((!wasJumping && IsOnGround) || jumpTime > 0.0f)
                {
                    if (jumpTime == 0.0f)
                    {
                        jump_sound.PlaySound();
                    }

                    jumpTime += (float)Globals.gameTime.ElapsedGameTime.TotalSeconds;
                }

                if (0.0f < jumpTime && jumpTime <= Globals.MAX_JUMP_TIME)
                {
                    velocityY = Globals.JUMP_VELOCITY * (1.0f - (float)Math.Pow(jumpTime / Globals.MAX_JUMP_TIME, Globals.JUMP_POWER));
                }
                else
                {
                    jumpTime = 0.0f;
                }
            }
            else
            {
                jump_sound.StopSound();
                jumpTime = 0.0f;
            }

            if (!IsOnGround)
            {
                PlayerState = Anim.Jump;
            }
            else
            {
                PlayerState = Anim.Idle;
            }

            wasJumping = IsJumping;

            return(velocityY);
        }
        public void Update()
        {
            UpdateState();

            if (IsAlive)
            {
                GetInput();
            }

            ApplyPhysics();

            ShootUpdate();

            if (CurrentShootingMode == ShootingMode.BigGun)
            {
                ShootTimer();
            }

            movement   = 0.0f;
            IsOnGround = false;
            IsShooting = false;

            if (Health <= 0)
            {
                //TODO: Die Sound not working right
                die_sound.PlaySound();

                deathDelay += Globals.gameTime.ElapsedGameTime;
                PlayerState = Anim.Dead;
                IsAlive     = false;

                if (deathDelay > TimeSpan.FromSeconds(5))
                {
                    OnDie();
                }
            }
        }
 public void OnCollision()
 {
     Health--;
     hit_sound.PlaySound();
     PlayerState = Anim.Hit;
 }
Beispiel #6
0
 public override void OnCollision()
 {
     hit_sound.PlaySound();
     IsVisible = false;
 }
Beispiel #7
0
 public void TurnOnMusic()
 {
     win_sound.PlaySound();
 }