How to trigger an action when two buttons are pressed at the same time?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Evoke22

(Sorry, my English isn’t that good)
I am very new to coding and I want to make my character to perform an action when two buttons are pressed at the same time.
For example: (Lshift + Right) to sprint.

Have you tried code such as this?

if Input.is_action_pressed("left_shift") and Input.is_action_pressed("arrow_right"):
      player.sprint()

Ertain | 2019-03-25 17:10

:bust_in_silhouette: Reply From: rahsut

You could go into the Input Map and add a new input. When adding the new input, add a key and then, on your keyboard, click left shift and right and that would work.

In the code, you could write code that says this:

# put the input name in quotation marks
if Input.is_action_pressed(""):
# put code here for sprinting
pass