Example #1
0
 /// <summary>
 /// Creates and adds stomp particles where the entity is.
 /// </summary>
 /// <param name="count"></param>
 public void CreateStompParticles(int count)
 {
     if (_stompParticleTimer.TimeElapsedInMilliSeconds > 100)
     {
         for (int i = 0; i < count; i++)
         {
             ParticleSystem.Add(ParticleType.Smoke, new Vector2(CalcHelper.GetRandomX(GetCollRectangle()), GetCollRectangle().Bottom), new Vector2(TMBAW_Game.Random.Next(-5, 5) / 10f, -TMBAW_Game.Random.Next(1, 5) / 10f), Color.White);
         }
         _stompParticleTimer.Reset();
     }
 }
Example #2
0
        public void OnJumpAction(Player player)
        {
            float jumpAcc = JumpAcc;

            if (player.IsDucking)
            {
                player.WantsToMoveDownPlatform = true;
                player.AddAnimationToQueue("fall");
                return;
            }
            if (player.IsClimbing)
            {
                if (player.IsInteractPressed())
                {
                    return;
                }
                player.IsClimbing = false;
                player.IsJumping  = false;

                if (player.IsMoveDownPressed())
                {
                    jumpAcc = 0;
                }
            }
            if (!player.IsJumping)
            {
                player.Sounds.GetSoundRef("jump").Play();
                player.IsJumping = true;
                player.SetVelY(jumpAcc);
                player.ChangePosBy(0, -1);
                player.AddAnimationToQueue("jump");
                player.CollidedWithTileBelow += OnTouchGround;
                _lastJumpTimer.Reset();
                player.GravityStrength = TMBAW_Game.Gravity * .5f;

                if (jumpAcc != 0)
                {
                    for (int i = 0; i < 10; i++)
                    {
                        ParticleSystem.Add(ParticleType.Smoke, new Vector2(CalcHelper.GetRandomX(player.GetCollRectangle()), player.GetCollRectangle().Bottom), new Vector2(TMBAW_Game.Random.Next((int)player.GetVelocity().X - 1, (int)player.GetVelocity().X + 1) / 10f, -TMBAW_Game.Random.Next(1, 10) / 10f), Color.White);
                    }
                }
            }
        }