Unreal compile error


// Fill out your copyright notice in the Description page of Project Settings.

#include “BullCowCartridge.h”

void UBullCowCartridge::BeginPlay() // When the game starts

{

Super::BeginPlay();

SetupGame();



PrintLine(TEXT("The HiddenWord is : %s "),*HiddenWord);

}

void UBullCowCartridge::OnInput(const FString& Input) // When the player hits enter

{

if(bGameOver)

{

    ClearScreen();

    SetupGame();

}

else//checkinng PlayerGuess

{

        if (Input==HiddenWord)

    {

        PrintLine(TEXT("You Won!"));  

        EndGame();

    }

    else

    {

        PrintLine(TEXT("only %i lives left",--Lives));

        if(Lives>0)

        {

            if (Input.Len() != HiddenWord.Len())    

            {

                PrintLine(TEXT("Sorry Try Guessing again!\nYou Have  lives Remaining0"));

                EndGame();

            }

        }  

         else

        {

            PrintLine(TEXT("You have no lives left"));

            EndGame();

        }

                 

    }

}



// Check If Isogram

// Prompt To Guess Again

// Check Right Number Of Characters

// Prompt To Guess Again

// Remove Life

// Check If Lives > 0

// If Yes GuessAgain

// Show Lives Left

// If No Show GameOver and HiddenWord?

// Prompt To Play Again, Press Enter To Play Again?

// Check User Input

// PlayAgain Or Quit

}

void UBullCowCartridge::SetupGame()

{

 //telling the user what to do

PrintLine(TEXT("Bull Cows"));  

   

//Promt Player For Guess

HiddenWord = TEXT("cake");

Lives = HiddenWord.Len( );

bGameOver =false;

PrintLine(TEXT("Guess The %i Letter Word!"),HiddenWord.Len());

PrintLine(TEXT("you have %i lives "),HiddenWord.Len());

}

void UBullCowCartridge::EndGame()

{

bGameOver = true;

PrintLine(TEXT("Press Enter To Play Again."));

}

TEXT only takes a single argument. Here you are giving it 2.

Lives needs to go between the ) i.e.

PrintLine(TEXT("only %i lives left"), --Lives);
1 Like

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

Privacy & Terms