The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+2 votes

I want to handle two inputs: left and right. But it seems that the _input
method from Node cant handle them.
So here is my scenario: When I press right my Character walks to the right; when I then press left (and keep right pressed) my Character walks to the left, which shouldn't happen since I press left and right and the movements should eliminate each other.

func _input(event):
    velocity.x -= WALK_SPEED

    velocity.x += WALK_SPEED

It seems like the _input method is only called for the last key pressed.
Is this normal? And how to get around this to have multiple inputs at once.

in Engine by (25 points)

1 Answer

+2 votes

Yes, it is normal.
Check my answer to this similar question:

by (29,360 points)

Thank you for your quick reply!

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.