![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | frantic_salamander |
I am making a 4-player local co-op game. I have 4 full sets of all of the inputs, each with a suffix representing the player number, i.e. move_up1, move_up2, etc.
Each player has an input action to switch directly to one of 9 weapons, for a total of 36 weapon-related inputs.
Currently what I have started writing is this:
func weapon_action(event):
if event.is_action_pressed("weapon11"):
return {"weapon": 1, "player": 1}
elif event.is_action_pressed("weapon12"):
return {"weapon": 1, "player": 2}
Is there a good way to get the pressed weapon # and player # without having 36 if…elif branches?