Code doesn't compile

on line 62 “Guess” is not declared and the code does not compile, I don’t know why.

#include "BullCowCartridge.h"

void UBullCowCartridge::BeginPlay() // When the game starts
{
    Super::BeginPlay();

    SetupGame();
    PrintLine(TEXT("The hidden word is: %s."), *Hiddenword);
    
}

void UBullCowCartridge::OnInput(const FString& Input) // When the player hits enter
{
    if(bGameOver)
    {
        ClearScreen();
        SetupGame();
    }
    else
    {
    	ProcessGuess(Input);

        
    }



    
    
    
    


}


void UBullCowCartridge::SetupGame()
{
     PrintLine(TEXT("Welcome to the Bull Cows game you mdafka"));
     Hiddenword = TEXT("Cake");

    Lives = Hiddenword.Len();

    bGameOver = false;

    PrintLine(TEXT("you have %i lives"), Hiddenword.Len());
     
    PrintLine(TEXT("Guess the %i letter word!"), Hiddenword.Len());
    PrintLine(TEXT("Enter words that will decide your fait"));

    
}

void UBullCowCartridge::EndGame()
{
    bGameOver = true;
    PrintLine(TEXT("press enter to play again."));
}

void UBullCowCartridge::ProcessGuess(Guess)
{
    if( Guess == Hiddenword)

        {
            PrintLine(TEXT("You have won:)"));

            EndGame();
        }
        else
        {
            
            
            if(Lives>0)
            {
                PrintLine(TEXT("you have lost a life"));
                if(Guess.Len() != Hiddenword.Len())
                {
                    
                    PrintLine(TEXT("Sorry, try again \n you have %i lives remaining"), --Lives);
                    PrintLine(TEXT("the hidden word is %i characters long"), Hiddenword.Len());
                }


            }
            else 
            {
                PrintLine(TEXT("you have no lives left"));
                EndGame();
            }
            
           

            


        }

}

This is missing the type for Guess

1 Like

oh, I am falling for the stupid things, thanks a lot, I really should pay attention for the little things

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms