Is it possible to set which order events are responded to or to cancel them?
For example, my game listens for ‘escape’ to toggle the in game menu and leave open menus.
I’d also like to have a Chat object that listens to ‘escape’ to cancel entering chat.
Currently, the escape event is handled by all direct objects that listen to it, so if you cancel chat, you also toggle the in game menu.
Is there anyway I can make it so that the chat object handles the escape event first and then cancels it? Or do I have to set it up so that the game knows that chat handle the event so that it doesn’t toggle the menu?
I forgot that the game listens to other key presses (e.g. wasd), so I’m going to have to know when the user is typing so I can temporarily disable listening to the movement keys. I was hoping to make my chat objects completely self contained, but I guess I’ll have to live with a small amount of coupling.
Usually you would handle something like this using finite state machines. Just make a state for chatting, menu and game. This will make it easy to manage which input is enabled when.
With the FSM, in terms of design, would it make sense for the FSM to turn off the input listening or just be used to see what state the user is in.
# re accept all the keyboard events
keys = 
if(inputFSM.state == 'Game'):
I ended up going with the former. Thanks for the help