In game menu for local mulitplayer

WhiningfieldsWhiningfields Posts: 11Member

Hi!
I'm making a local 4 player game and have had a great deal of problems with implementing a in game menu for weapon selection. I've got the menu to appear for each player - the 'weapon_menu' scene consists of a 'node2d with a grid container and three buttons as children). Testing with print statements, the input does register in the weapon_menu scene - but how do I get the buttons to actually register the input (as in how to move to the next button and highlight it etc. on input)?

What I'm going for is - input up/down for choosing a button and left/right for selecting/pressing it.

*I've looked at too many tutorials on GUIs and general menus - but found none explaining this (as an in game menu - ie the game is still running, and using gui_input seems off (as in setting up gui_input for 4 players instead of using the inputs already there). If I've missed a good tutorial on this exact subject, please feel free to point me to it.

I'm rather new, and exact feedback is appreciated as I'm at a total loss figuring this out.

Thank you!


Tags :

Answers

  • vinpogovinpogo Posts: 26Member

    so if i understand correctly each player can open this menu during gameplay, and the problem is that the inputs should only apply on the menu GUI and not control the player while the menu is open.
    If thats the case, you can simply set a boolean flag on the player, and do not process input event if this flag is set.

    Another way which means more work is to add a Custom Input singleton, qhich emits signals on every input. Then you can also check which device fired that inputEvent and you in game nodes can only listen to their signals.

    Hop i could help, let me know if anythings unclear

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file