Exemplo n.º 1
0
        public void GameOver()
        {
            newWord = newWord.ToUpper();
            PersonDraw hangMan = new PersonDraw();

            hangMan.HangmanDraw(0);


            Console.WriteLine("Game Over!");
            Console.WriteLine($"The answer was {newWord}! ");

            Console.WriteLine("Would you like to play again?");
            var answer = Console.ReadLine().ToLower();

            if (answer == "yes" || answer == "y")
            {
                repeatGame = true;
            }
            else if (answer == "no" || answer == "n")
            {
                repeatGame = false;
            }
            else
            {
                Console.WriteLine("Invalid selection");
            }
        }
Exemplo n.º 2
0
        public void StartGame()
        {
            Console.WriteLine("Want to play a game?");

            do
            {
                Console.Clear();
                game = new GameSetup();
                PersonDraw hangMan = new PersonDraw();

                Console.WriteLine("Select Difficulty: Easy (E), Medium (M), Hard (H) or Random (R)");
                string difficultySelected = Console.ReadLine().ToUpper();

                game.WordGenerator(difficultySelected);
                Console.Clear();

                while (game.Lives != 0)
                {
                    hangMan.HangmanDraw(game.Lives);

                    game.PrintingLetterOrUnderscoreToConsole();

                    if (game.repeatGame == true)
                    {
                        break;
                    }

                    Console.WriteLine();
                    Console.WriteLine();
                    game.PrintGuessedLetters();
                    Console.WriteLine();
                    Console.WriteLine("Guess the word:");

                    string userGuess = Console.ReadLine();

                    game.ConfirmingTypeofInput(userGuess);

                    Console.Clear();
                }
                game.CheckIfUserPlaysAgain();
            }while (game.repeatGame == true);
        }