0 votes

(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.

in Engine by (12 points)

Have you tried code such as this?

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

1 Answer

+1 vote

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

by (192 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.