As always, I seem to have overcomplicated the lives implementation
void UBullCowCartridge::OnInput(const FString& Input) // When the player hits enter
{
if (bGameOver)
{
ClearScreen();
SetupGame();
}
else //Checking PlayerGuess
{
if (Input == HiddenWord)
{
PrintLine (TEXT("You win!"));
EndGame();
}
else
{
Lives = --Lives;
if (Lives > 0)
{
PrintLine(TEXT("WROOOOOOONG!"));
PrintLine(TEXT("You have %i lives left"), Lives);
if (Input.Len() != HiddenWord.Len())
{
PrintLine(TEXT("It's %i letters long, dummy, \nyou have %i lives left..."), HiddenWord.Len(), Lives);
}
}
else
{
PrintLine(TEXT("You have %i lives left. \nYou have lost!"), Lives);
EndGame();
}
}
}
Does this kind of thing happen to you too, where you go a much much longer way to get to the same spot? Is this a noob thing, or just my way of thinking?
Are there any possible issues I should watch out for using this kind of logic, aside from having overcomplicated and unnecessarily long/obtuse code?