//private Player playerTest = new Player("Pesho", 100, new List<Ability>(), new Point(0, 0)); public static void StartGame() { MapFactory mapFactory = new MapFactory(); Map = mapFactory.GenerateMap(Maptypes.FirstLevelMap); Map.Print(); // insert validations for different maps Player playerTest = new Player(new Point(1, 1), "Pesho", 100, new List<Ability> { new Ability(1, 1, AbilityType.Offensive) }); Console.SetCursorPosition(122, 0); Console.Write("Level: {0}", playerTest.Level); while (true) { CheckForPressedKey(playerTest); } }
private static void CheckForPressedKey(Player player) { if (Console.KeyAvailable) { ConsoleKeyInfo pressedKey = Console.ReadKey(true); while (Console.KeyAvailable) { Console.ReadKey(true); } if (pressedKey.Key == ConsoleKey.LeftArrow) { player.MovePlayer(0, -1); //CleanBattleField("left"); //DrawGameField(); } else if (pressedKey.Key == ConsoleKey.RightArrow) { player.MovePlayer(0, 1); //CleanBattleField("right"); //DrawGameField(); } else if (pressedKey.Key == ConsoleKey.UpArrow) { player.MovePlayer(-1, 0); //CleanBattleField("up"); //DrawGameField(); } else if (pressedKey.Key == ConsoleKey.DownArrow) { player.MovePlayer(1, 0); //CleanBattleField("down"); //DrawGameField(); } //else if (pressedKey.Key == ConsoleKey.E && gamePause == false) //{ // Console.BackgroundColor = ConsoleColor.Black; // Console.Clear(); // Console.ForegroundColor = ConsoleColor.Red; // Console.WriteLine("Good bye!"); // Console.ForegroundColor = ConsoleColor.Gray; // Environment.Exit(0); //} //else if (pressedKey.Key == ConsoleKey.P) //{ // if (gamePause) // { // gamePause = false; // } // else // { // gamePause = true; // while (gamePause) // { // CheckForPressedKey(); // } // } //} //else if (pressedKey.Key == ConsoleKey.S) //{ // SaveGame(); //} //else if (pressedKey.Key == ConsoleKey.L) //{ // LoadSavedGame(); // CleanBattleField(); // DrawGameField(); // //CreateBonuses(); //} //else if (pressedKey.Key == ConsoleKey.B) //{ // time += 20; //} //else if (pressedKey.Key == ConsoleKey.N) //{ // time -= 20; //} //else if (pressedKey.Key == ConsoleKey.T) //{ // torchLight++; //} //else if (pressedKey.Key == ConsoleKey.R) //{ // torchLight--; // CleanBattleField(); // DrawGameField(); //} } }