Pause logic - bug?

I want to pause the game when “p is pressed” OR the “reset button is pressed”.

It pauses the game correctly but, the button text is not properly update.

If I remove the “p is pressed” logic or remove the “reset button pressed” logic, the button text is properly updated.

And the issue only happens when you press the “p” key, correct? It works when the PauseButton object is clicked.

This happens because clicking the PauseButton selects it and makes it available for the event and its subevents. However, pressing the ‘P’ key doesn’t select a PauseButton because it hasn’t been clicked and so hasn’t been selected, so it’s not in scope for the text change events.

This is easily fixed by adding a “Pick all PauseButton objects”:

1 Like

Indeed the problem was with “P key is pressed”, and now … it works!

But I really don’t get why it works :frowning: with that “pick all button objects”

What the button has to do with “p key” ? They are different things …

When the ‘P’ key is pressed, the PauseButton has not been clicked and so the condition “PauseButton has been pressed” is not met.

Remember, the condition is the PauseButton is pressed. But the PauseButton hasn’t been pressed and so doesn’t meet the condition.

Because that condition is not met, the PauseButton has not been selected and is not in scope in the event and its subevents.

However, the ‘Pick all PauseButton objects’ will select all PauseButton objects and put them all in scope for the event and subevents.

1 Like