General game controls

Hi all!

A strange question: I’m about to design a menu system for my game:

Player is controlled by WSAD or cursor keys

Menu is driven by the same keys (WSAD or cursor keys)

Now, what would the best method be so the menu system can use the same keys as the in-game controls? Is it a case of disabling one script / logic cluster whilst the other is ‘live’ or can objects that the player directly interacts with can be ‘own.’ (like objects can be own.blah rather than cube .blah). How have others done this?

Its been a long day so I hope this makes sense!


The way I think i’d think it is… with script, i’d use generic actions e.g. left, right, up, down, etc and write a function which reads the key states of the keys required mapping them to my generic action variables.

A simpler way: Have the Main menu in a different scene, and use states or Boolean Logic to set an in-game menu.

Actually, I believe rarebit addresses the in-game menu nicely, but were you also speaking of a Main menu?

I just use a variable to check to see if the game is in a main menu, and if so, then disable the Player’s controls, and vice versa. Rarebit’s method of using a function may be better, though. I’d like to get more info about exactly how your process works, though, Rarebit.

This is a conceptual thing.
Do you want to simply disable all input of the game when showing a menu to prevent conflicting input?
or do you want some input in the menu while others remains in the game?

Method A: switch to a menu scene - this removes the game scene and all its processing
Method B: suspend the game scene while adding the menu scene and resume the game scene when removing the menu scene.
Method C: Check the input logic to be active or inactive, toggle this state when opening/closing the menu. You can do that with states, properties or whatever. Messages could be useful for that. The disadvantage is, you need to do that for each single input. See the previous posts for suggestions.

I hope it helps

Thanks for the information, guys!