Esempio n. 1
0
        public void Jump()
        {
            midAir = true;
            int count = 0;

            while (count < 5)
            {
                Thread.Sleep(20);
                if (positionY > 1)
                {
                    if (Map.mapArray[positionY - 2][positionX - 1] == ' ' &&
                        Map.mapArray[positionY - 2][positionX] == ' ' &&
                        Map.mapArray[positionY - 2][positionX + 1] == ' ')
                    {
                        DrawEngine.RemovePlayerAt(this);
                        positionY--;
                        DrawEngine.DrawPlayer(this);
                    }
                    count++;
                }
                GameEngine.ExecuteControlsOnJump(this);
            }
            Drop();
            midAir = false;
        }
Esempio n. 2
0
 public void MoveRight()
 {
     if (positionX < 118)
     {
         if (Map.mapArray[positionY][positionX + 2] == ' ' &&
             Map.mapArray[positionY + 1][positionX + 2] == '#')
         {
             DrawEngine.RemovePlayerAt(this);
             positionY--;
             DrawEngine.DrawPlayer(this);
         }
         if (Map.mapArray[positionY][positionX + 2] == ' ' &&
             Map.mapArray[positionY - 1][positionX + 2] == ' ' &&
             Map.mapArray[positionY + 1][positionX + 2] == ' ')
         {
             DrawEngine.RemovePlayerAt(this);
             positionX++;
             DrawEngine.DrawPlayer(this);
         }
         if (!midAir)
         {
             Drop();
         }
     }
     SearchA();
     SearchE();
 }
Esempio n. 3
0
        public static void Game()
        {
            Player player = new Player();

            DrawEngine.DrawMap();
            DrawEngine.DrawPlayer(player);

            ExecuteControls(player);
        }
Esempio n. 4
0
 public void Drop()
 {
     while (true)
     {
         Thread.Sleep(20);
         if (Map.mapArray[positionY + 2][positionX - 1] == ' ' &&
             Map.mapArray[positionY + 2][positionX] == ' ' &&
             Map.mapArray[positionY + 2][positionX + 1] == ' ')
         {
             DrawEngine.RemovePlayerAt(this);
             positionY++;
             DrawEngine.DrawPlayer(this);
         }
         else
         {
             break;
         }
     }
 }