Exemple #1
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();
 }
Exemple #2
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;
        }
 public static void GreetingE()
 {
     Console.Clear();
     DrawEngine.PrintAtPosition(55, 15, "We are sorry!");
     DrawEngine.PrintAtPosition(50, 17, "You have earned E!");
     Thread.Sleep(2000);
     Menu();
 }
 public static void GreetingA()
 {
     Console.Clear();
     DrawEngine.PrintAtPosition(55, 15, "Congradulations!");
     DrawEngine.PrintAtPosition(50, 17, "You have earned A!");
     Thread.Sleep(2000);
     Menu();
 }
        public static void Game()
        {
            Player player = new Player();

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

            ExecuteControls(player);
        }
        public static void Menu()
        {
            int MenuItemSelected = 0;

            DrawEngine.DrawMenu(MenuItemSelected);
            while (true)
            {
                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo keyInfo = Console.ReadKey();
                    if (keyInfo.Key == ConsoleKey.W || keyInfo.Key == ConsoleKey.UpArrow)
                    {
                        if (MenuItemSelected > 0)
                        {
                            MenuItemSelected--;
                            DrawEngine.DrawMenu(MenuItemSelected);
                        }
                    }
                    if (keyInfo.Key == ConsoleKey.S || keyInfo.Key == ConsoleKey.DownArrow)
                    {
                        if (MenuItemSelected < 2)
                        {
                            MenuItemSelected++;
                            DrawEngine.DrawMenu(MenuItemSelected);
                        }
                    }
                    if (keyInfo.Key == ConsoleKey.Enter)
                    {
                        break;
                    }
                }
            }
            switch (MenuItemSelected)
            {
            case 0:
                Game();
                break;

            case 1:
                Settings();
                break;

            case 2:
                Exit();
                break;
            }
        }
Exemple #7
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;
         }
     }
 }