Topic was automatically imported from the old Question2Answer platform.
Asked By
rslepon
Keyboard input support modifiers such as shift/alt/ctrl, so that I can have shift+A do something different from ctrl+A, even though they both use the same KEY_A scancode.
Is there some way to get comparable behaviour for a gamepad/joystick/joypad/controller, so that for example, if the player holds R2 while clicking X it does one thing, and if the player does not hold R2 while clicking X, it does another thing?
func _process(delta):
if Input.is_action_pressed("ui_x_box_modifier_right_trigger") \
and Input.is_action_just_pressed("ui_x_box_button_x"):
print("x pressed while right trigger was pressed")
#code for doing first thing here
elif Input.is_action_just_pressed("ui_x_box_button_x"):
print("x pressed without right trigger")
#code for doing another thing here
(the input names can be named and set in input-settings in the project settings, they do not have to have same names as in my example)