Life lost on game reset

Hi, got stuck again on BullCow. when my game ends and resets, it resets with a lif lost already, doesn’t start at 5 again as in the lecture.

to amend to the above here is how it behaves:
Startup:
UE_bullcow_startup

Entering the correct word:
UE_bullcow_5 correct characters

Entering a character count above or below 5:
UE_bullcow_below or above 5 characters

Entering the correct character count only:
UE_bullcow_5 wrong characters

Game restart with life already lost:
UE_bullcow_reset with life lost

I’m a bit lost now.

If bGameOver is true, what happens after line 19?

HI there
Hope I understand your question, from line 19;
*if the HiddenWord was correct then print a congratulation message and EndGame.

The EndGame function bGameOver is true and print “Hit enter to start again.”
Now it starts again but includes that a life is lost and the countdown starts from 4.

OnInput Function:

SetupGame and EndGame

I think you may have missed my point.

So lets go back one round, so bGameOver == false and you’ve entered the correct word.
Step by step

Line 15 - false, go to line 20
Line 20 - Input == HiddenWord == true
Line 22 - Print message
Line 23 - Call EndGame, user is told to press enter to continue
Line 25 - `else` do nothing, end of function.

// User has pressed  enter
Line 15 - true
Line 17 - ClearScreen()
Line 18 - SetupGame()
Line 20 - ...

That last part is what I was trying to get you to realise what is happening.

O, got it to work by adding an else statement on line 20

1 Like

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

Privacy & Terms