static void MainMain() { //Intro.printIntro(); Console.BufferWidth = Console.WindowWidth; Console.BufferHeight = Console.WindowHeight; int speed = 100; ObjectDrawer gameRenderer = new ObjectDrawer(Console.WindowHeight, 60); IUserInterface keyboard = new KeyboardInterface(); Engine gameEngine = new Engine(gameRenderer, keyboard, speed); Position shipPos = new Position(Console.BufferHeight - 3, 30); Ship ship = new Ship(shipPos); gameEngine.AddShip(ship); keyboard.OnUpPressed += (sender, eventInfo) => { gameEngine.MoveShipUp(); }; keyboard.OnDownPressed += (sender, eventInfo) => { gameEngine.MoveShipDown(); }; keyboard.OnLeftPressed += (sender, eventInfo) => { gameEngine.MoveShipLeft(); }; keyboard.OnRightPressed += (sender, eventInfo) => { gameEngine.MoveShipRight(); }; keyboard.OnActionPressed += (sender, eventInfo) => { gameEngine.ShipShoot(); }; keyboard.OnPausePressed += (sender, eventInfo) => { Console.SetCursorPosition((Console.WindowWidth / 2) - 6, Console.WindowHeight / 2); Console.WriteLine("Press any key to continue!"); Console.ReadKey(true); }; gameEngine.Run(); TryAgain: try { StarshipFightMain.Restart(); } catch (GameException) { Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Invalid button! Try Again"); Console.ResetColor(); goto TryAgain; } }