void UBullCowCartridge::OnInput(const FString& PlayerInput) // When the player hits enter
{
if (bGameOver)
{
ClearScreen();
SetupGame();
}
else // checking the player guess
{
ProcessGuess(PlayerInput);
}
}
Why is it that the bool here, bGameOver, does not say if bGameOver = true ?
It seems like if the game is over we want to clear the screen and setup the game.
else (if the game is not over, hence bGameOver = false) we go ahead and process the player input.
I don’t really understand why this works… it seems like by not assigning a true or false value we are basically saying check to see IF bGameOver is true OR false. which to me the code is basically saying:
if (bGameOver == true || false)
{
ClearScreen();
SetupGame();
}
Which isn’t what we want, right? (disregarding the fact that this may be improperly written code)
I see that we assign the bGameOver bool as false in the SetupGame function, and true in the EndGame function. That makes sense to me in a general way. While we are setting up the game we don’t want the game to be over. Yet when the end of the game is reached of course we want the game to be over. But when the player makes his input we are allowing the bGameOver bool (which can only be true or false) to be undecided?
The instructor says in the video. “You don’t have to add true to the end of bGameOver because this is going to be either true or false right from the offset.” But then he just moves on and doesn’t say anything else about it. That leaves so much unsaid in my mind… Please, what am I missing?