Пример #1
0
        public void MoveCharacter(AnimatedSprite.PlayerDirection direction)
        {
            //if (GameTimerHandler.CurrentGameTime == 30)
            //{
            //    Sprite.Alive = false;
            //}

            if (Sprite.Alive)
            {
                Sprite.Position.Y = LastPlayerY;

                SetCurrentDirection(direction);
                SetCorretSpeedOnPlayer();
                MovePlayerLeftOrRight();

                if (PlayerState.Equals(State.Jumping) && AllowJump)
                {
                    Jump();
                }

                LastplayerDirection = direction;

                if (!JumpInProgress)
                {
                    Sprite.Position.Y = LastPlayerY + FallingVelocity;
                    if (FallingVelocity < 7.0)
                    {
                        FallingVelocity = FallingVelocity + 0.2f;
                    }
                }
                else
                {
                    Sprite.Position.Y = LastPlayerY - JumpingVelocity;
                    if (JumpingVelocity < 1.0)
                    {
                        JumpingVelocity = JumpingVelocity - 0.8f;
                    }
                }


                LastPlayerY = Sprite.Position.Y;

                PlayerState = State.Walking;
            }
        }
Пример #2
0
 protected void SetCurrentDirection(AnimatedSprite.PlayerDirection direction)
 {
     CurrentPlayerDirection = direction;
 }
Пример #3
0
 protected void SetCurrentDirection(AnimatedSprite.PlayerDirection direction)
 {
     CurrentPlayerDirection = direction;
 }