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):
if(event.is_action("move_left")):
print("left")
velocity.x -= WALK_SPEED
#get_tree().set_input_as_handled()
if(event.is_action("move_right")):
velocity.x += WALK_SPEED
print("right")
#get_tree().set_input_as_handled()
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.