I did it with this:
void UBullCowCartridge::BeginPlay() // When the game starts
{
Super::BeginPlay();
SetupGame();
...
}
void UBullCowCartridge::SetupGame()
{
HiddenWord = TEXT("cake");
Lives = 3;
HiddenWordLength = HiddenWord.Len();
}
If you store the result into the implementation of BeginPlay() function then it would only available in that function right? So that leaves the function UBullCowCartridge::OnInput
which also needs the result.
but it might be a little complex setup.
I did this kind of setup because on every input change then we do calculate the amount of characters everytime and we do know them a step ahead. So I did think if we assign it into the header file then. it only gets calculated ones the HiddenWord has been initialized.
What do you think about it?
It might change in the forward sections but I was just curious about the current situation without the next lectures.