Esempio n. 1
0
 public void MoveRight(PlayerAnimations animation, Level level, GameTime gameTime, Collision collision)
 {
     if (!collision.checkPlayerLevelCollision(animation, this, level).Contains("Right"))
     {
         animation.BotState = PlayerAnimations.BottomAnimationState.Walking;
         if (!screenLocked)
         {
             level.MoveLevel(1);
         }
         else
         {
             if (location.X < GlobalVars.resolutionWidth - animation.playerTex[animation.currentframe].Width)
             {
                 location += new Vector2(GlobalVars.playerSpeed, 0);
             }
         }
     }
 }
Esempio n. 2
0
        public bool MoveToCenter(PlayerAnimations animation, Level level)
        {
            if (!screenLocked)
            {
                int center = GlobalVars.resolutionWidth / 2 - animation.playerTex[animation.currentframe].Width;

                if (location.X > center)
                {
                    location -= new Vector2(GlobalVars.playerSpeed, 0);
                    level.MoveLevel(1);
                }

                if (location.X < center)
                {
                    location += new Vector2(GlobalVars.playerSpeed, 0);
                    level.MoveLevel(-1);
                }

                if (location.X == center)
                {
                    return true;
                }
                return false;
            }
            return true;
        }
Esempio n. 3
0
        public void MoveLeft(PlayerAnimations animation, Level level, GameTime gameTime, Collision collision)
        {
            if (level.location > 0)
            {
                if (!collision.checkPlayerLevelCollision(animation, this, level).Contains("Left"))
                {
                    animation.Moving(gameTime);

                    if (!screenLocked)
                    {
                        level.MoveLevel(-1);
                    }
                    else
                    {
                        if (location.X > 0)
                        {
                            location -= new Vector2(GlobalVars.playerSpeed, 0);
                        }
                    }
                }
            }
        }