#include "BullCowCartridge.h"
void UBullCowCartridge::BeginPlay() // When the game starts
{
Super::BeginPlay(); //Required for the game to start
//game intro message
PrintLine(TEXT("Welcome friend I bet you have come to win the pasture teasure."));
PrintLine(TEXT("I will tell you where in the field you can find it but......."));
PrintLine(TEXT("You will have to win my challenage first"));
//Gather the hidden word from a list
HiddenWord = TEXT("House"); //need hidden word list
//set lives
//testing purpose show the hidden word that has been selected
//PrintLine(HiddenWord);
//Ask for a guess at a word
PrintLine(TEXT("I am thinking of an Isogram you must guess it right in 4 trys."));
PrintLine(TEXT("The word I am thinking of is 5 character long"));
//later replace 5 with a variable to show the characters in the word
//randomly choosen
PrintLine(TEXT("Good Luck what do you think the word is?"));
}
void UBullCowCartridge::OnInput(const FString& Input) // When the player hits enter
{
//testing purpose only shows what the user entered to confirm input if functioanl
//PrintLine(Input);
//check if its isogram if it is not route to guess again function with cause
//check letter count if it is not right, route to guess again function with cause
if(Input == HiddenWord)
{
PrintLine(TEXT("Great job you guessed right"));
}
else
{
PrintLine(TEXT("incorrect try again"));
//if lives is greater then 0
//--lives for the fail
//route to guess again and update lives
//else lives is 0 go to play again function
//clear the screen of the guess if its incorrect
}
}
//play again Function if user selects yes clearscreen fully and restart at begin play
//if user selects no quit application
//Guess again Function that displays the past guess and game information but has
//removed the welcome message
2 Likes
Amazing pseudo code!