static void Main(string[] args) { GamePacman newGame = new GamePacman(2, 2); //params: кол-во жизней pacman, кол-во привидений в игре newGame.SetPacman(true); // param: Установка pacman на игровом поле 0 - default coordinate(1,1), 1 - random newGame.Start(); Console.Read(); }
static void Main(string[] args) { GamePacman newGame = new GamePacman(); newGame.SetPacman(true); ConsoleKeyInfo keyInfo2; Console.Clear(); newGame.Print(); keyInfo2 = Console.ReadKey(); do { switch (keyInfo2.Key) { case ConsoleKey.DownArrow: case ConsoleKey.NumPad2: case ConsoleKey.S: do { Thread.Sleep(400); Console.Clear(); newGame.Print(); if (Console.KeyAvailable) { keyInfo2 = Console.ReadKey(true); break; } } while (newGame.GoDown()); break; case ConsoleKey.LeftArrow: case ConsoleKey.NumPad4: case ConsoleKey.A: do { Thread.Sleep(400); Console.Clear(); newGame.Print(); if (Console.KeyAvailable) { keyInfo2 = Console.ReadKey(true); break; } } while (newGame.GoLeft()); break; case ConsoleKey.RightArrow: case ConsoleKey.NumPad6: case ConsoleKey.D: do { Thread.Sleep(400); Console.Clear(); newGame.Print(); if (Console.KeyAvailable) { keyInfo2 = Console.ReadKey(true); break; } } while (newGame.GoRight()); break; case ConsoleKey.UpArrow: case ConsoleKey.NumPad8: case ConsoleKey.W: do { Thread.Sleep(400); Console.Clear(); newGame.Print(); if (Console.KeyAvailable) { keyInfo2 = Console.ReadKey(true); break; } } while (newGame.GoUp()); break; } } while (keyInfo2.Key != ConsoleKey.Escape); }