Example #1
0
        private static void PlaceTowers(ConsoleKey key, Towers tower)
        {
            int towerType;

            if (key == ConsoleKey.NumPad1)
            {
                towerType = 1;
                tower.TowerPlacement(playerCurrentPossitionX, playerCurrentPossitionY, towerType);
            }
            if (key == ConsoleKey.NumPad2)
            {
                towerType = 2;
                tower.TowerPlacement(playerCurrentPossitionX, playerCurrentPossitionY, towerType);
            }
            if (key == ConsoleKey.NumPad3)
            {
                towerType = 3;
                tower.TowerPlacement(playerCurrentPossitionX, playerCurrentPossitionY, towerType);
            }
            if (key == ConsoleKey.NumPad4)
            {
                towerType = 4;
                tower.TowerPlacement(playerCurrentPossitionX, playerCurrentPossitionY, towerType);
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            RemoveScrollBars();

            // PLACEHOLDERS!!!
            List <Enemies> mainEnemies   = new List <Enemies>();
            Towers         tower         = new Towers();
            string         someDirection = "Down";

            // PLACEHOLDERS!!!



            while (isRuning)
            {
                /*
                 * Everything is more or less a lot of if-else checks and a lot of Console.Writeline();
                 * Be mindful of the other parts of the code and ask questions on Skype or if you need help!
                 * We will make a lot of static methods and we will only write them in this file. No OOP elements!
                 */


                //Prevents Console getting stuck on waiting for a key press, it only triggered when a key is pressed.
                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo keyInfo = Console.ReadKey();
                    if (startNewGame)
                    {
                        MovePlayer(keyInfo.Key);
                        PlaceTowers(keyInfo.Key, tower); // Implement towers!
                    }
                    else
                    {
                        MenuControl(keyInfo.Key);
                    }
                }

                /*
                 * TODO: Towers
                 * TODO: Implement 4 different towers [See Trello for more details]
                 */

                Console.Clear();
                // TODO: Implement "DrawMenu();" else Console.Clear(); just wipes the console entirely

                /*
                 * CHECK MENU CONTROL METHOD ABOVE!!!
                 * TODO: Menu
                 * TODO: Implement "Start new game"
                 * TODO: Implement "Highscore" option
                 * TODO: Implement "How to play" option
                 * TODO: Implement stop function [Use "Environment.Exit(-1);" in menu]
                 */



                /*
                 * TODO: Enemy movement
                 * TODO: Implement enemy spawn and movement
                 * TODO: Implement enemy HP, Points and gold drop
                 * TODO: Implement ground and air only enemies
                 */
                WaveInitialization(mainEnemies);
                WaveMovement(mainEnemies, someDirection); // Enemies go down on console when spawned - temporary - change someDirection for anther direction

                /*
                 * TODO: Map
                 * TODO: Implement Station possition on console + HP of station
                 * TODO: Player start possition + player collision with station - see player movement method.
                 */

                /*
                 * TODO: At game end, show on screen score and first 3 high score possitions!
                 * TODO: If new score is > from current highscores, add and move possitions!
                 * TODO: Write to file the highscores!
                 */

                Thread.Sleep(60);
            }
        }
        static void Main(string[] args)
        {
            RemoveScrollBars();

            // PLACEHOLDERS!!!
            List<Enemies> mainEnemies = new List<Enemies>();
            Towers tower = new Towers();
            string someDirection = "Down";
            // PLACEHOLDERS!!!

            while (isRuning)
            {

                /*
                Everything is more or less a lot of if-else checks and a lot of Console.Writeline();
                Be mindful of the other parts of the code and ask questions on Skype or if you need help!
                We will make a lot of static methods and we will only write them in this file. No OOP elements!
                */

                //Prevents Console getting stuck on waiting for a key press, it only triggered when a key is pressed.
                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo keyInfo = Console.ReadKey();
                    if (startNewGame)
                    {
                        MovePlayer(keyInfo.Key);
                        PlaceTowers(keyInfo.Key, tower); // Implement towers!
                     }
                    else
                    {
                        MenuControl(keyInfo.Key);
                    }

                }
                /*
                TODO: Towers
                TODO: Implement 4 different towers [See Trello for more details]
                */

                Console.Clear();
                // TODO: Implement "DrawMenu();" else Console.Clear(); just wipes the console entirely

                /*
                CHECK MENU CONTROL METHOD ABOVE!!!
                TODO: Menu
                TODO: Implement "Start new game"
                TODO: Implement "Highscore" option
                TODO: Implement "How to play" option
                TODO: Implement stop function [Use "Environment.Exit(-1);" in menu]
                */

                /*
                TODO: Enemy movement
                TODO: Implement enemy spawn and movement
                TODO: Implement enemy HP, Points and gold drop
                TODO: Implement ground and air only enemies
                */
                WaveInitialization(mainEnemies);
                WaveMovement(mainEnemies, someDirection); // Enemies go down on console when spawned - temporary - change someDirection for anther direction

                /*
                TODO: Map
                TODO: Implement Station possition on console + HP of station
                TODO: Player start possition + player collision with station - see player movement method.
                */

                /*
                TODO: At game end, show on screen score and first 3 high score possitions!
                TODO: If new score is > from current highscores, add and move possitions!
                TODO: Write to file the highscores!
                */

                Thread.Sleep(60);
            }
        }
 private static void PlaceTowers(ConsoleKey key, Towers tower)
 {
     int towerType;
     if (key == ConsoleKey.NumPad1)
     {
         towerType = 1;
         tower.TowerPlacement(playerCurrentPossitionX, playerCurrentPossitionY, towerType);
     }
     if (key == ConsoleKey.NumPad2)
     {
         towerType = 2;
         tower.TowerPlacement(playerCurrentPossitionX, playerCurrentPossitionY, towerType);
     }
     if (key == ConsoleKey.NumPad3)
     {
         towerType = 3;
         tower.TowerPlacement(playerCurrentPossitionX, playerCurrentPossitionY, towerType);
     }
     if (key == ConsoleKey.NumPad4)
     {
         towerType = 4;
         tower.TowerPlacement(playerCurrentPossitionX, playerCurrentPossitionY, towerType);
     }
 }