// Handle user input and transition to new level if needed public void HandleInput(ConsoleKeyInfo key) { LevelTransition newLevel = null; // Different user actions switch (key.Key) { case ConsoleKey.W: newLevel = CurrentLevel.MovePlayer(Player, Constants.DIRECTION.NORTH); break; case ConsoleKey.A: newLevel = CurrentLevel.MovePlayer(Player, Constants.DIRECTION.WEST); break; case ConsoleKey.S: newLevel = CurrentLevel.MovePlayer(Player, Constants.DIRECTION.SOUTH); break; case ConsoleKey.D: newLevel = CurrentLevel.MovePlayer(Player, Constants.DIRECTION.EAST); break; case ConsoleKey.Spacebar: Player.Attack(CurrentLevel); break; case ConsoleKey.Escape: DisplayMenu(); break; default: break; } if (newLevel != null) { TransitionToLevel(newLevel); } }