Hello all.
I created a score as a global variable that sums the score across multiple stages.
I created an event with the action of pressing the replay button to show the score(ScoreLabel) when the game fails, and then reset the score to 0 when starting a new game.
However, the score is not reset to 0 and the replay game starts with the previous score. How can I get the score to return to 0?
- Check the GameState Condition:
- The variable
GameState
must equal"Lost"
and this event is triggered once. IfGameState
does not match"Lost"
at the exact moment, the reset action forGlobalScore
will not execute.
- Replay Button Logic:
- Resetting
GlobalScore
is nested within the conditions for the cursor/touch being on theReplay_Button
and the left mouse button being released. - If either of these conditions fails (e.g., the
Replay_Button
is not properly clicked or detected), theGlobalScore
reset will not occur.
- Trigger Once:
- The use of “Trigger Once” can sometimes cause issues in complex event logic if the event conditions are not consistently true. Ensure
GameState
is properly updated and matches"Lost"
before clicking theReplay_Button
.
1 Like