Пример #1
0
        // Moves player on the screen by x and y.
        // checks to make sure player is still on the screen
        public void MovePlayer(float x, float y, Room CurrentRoom)
        {
            Vector2 Target = new Vector2(MyPlayer.Position.X + x, MyPlayer.Position.Y + y);

            if (canMove(MyPlayer, x, y, CurrentRoom))
            {
                MyPlayer.Position.X += x;
                MyPlayer.Position.Y += y;
                isPlayerAtWall       = false;
            }
            //else if (canMove(MyPlayer, x, 0, CurrentRoom))
            //{
            //    MyPlayer.Position.X += x;
            //    isPlayerAtWall = false;
            //}
            //else if (canMove(MyPlayer, 0, y, CurrentRoom))
            //{
            //    MyPlayer.Position.Y += y;
            //    isPlayerAtWall = false;
            //}
            else
            {
                if (!isPlayerAtWall && isSoundOn && !isPlayerAtDoor)
                {
                    MySound.PlayAttack();
                }
                isPlayerAtWall = true;
            }
        }
Пример #2
0
 // Moves player on the screen by x and y.
 // checks to make sure player is still on the screen
 public void MovePlayer(float x, float y)
 {
     if (canMove(x, y))
     {
         MyPlayer.Position.X += x;
         MyPlayer.Position.Y += y;
         //MyPlayer.Origin.X += x;
         //MyPlayer.Origin.Y += y;
         isPlayerAtWall = false;
     }
     else
     {
         if (!isPlayerAtWall && isSoundOn)
         {
             MySound.PlayAttack();
         }
         isPlayerAtWall = true;
     }
 }