Turn off responsiveness for other layers

I made a game interface, and then I need to pop up the menu, but clicking will cause the back interface to respond, so is there any way to make the back page not respond?

Use a FSM approach to your game. Store the state of your game (say “Main Menu”, “Settings”, “Playing”, “Paused” “Game Over” etc) in a global variable, say GameState.

Then have a condition event for each state (text of global variable GameState = “…”) and as subevents have all the events for that state.

So in your Main Menu state, it’ll be mouse clicks for all the object on the main menu. Similarly for Settings sub events only dealing with the clicks on objects on the setting scene. And so on for all the other states.

That way, if the state is the pop up menu, then it only the events for it are actioned. The others won’t be because the conditions aren’t met.

4 Likes