I'm tweaking GDquest's platform tutorial as a starting point for a platform test. In my test, I'm trying to make it so that tapping right and left to builds speed as if on a skateboard. Essentially something like this:
func _input(event): if Input.is_action_pressed("move_right"): speed.x += acceleration print("move_right") elif Input.is_action_pressed("move_left"): speed.x -= acceleration print("move_left")
So far it's working pretty well (there's a little more to it, but this is the basic idea to demonstrate the problem I'm running into) but with one minor glitch:
I'm using the event input because I don't want it to keep building speed if you hold the D-pad (to which move_left and move_right are mapped) I want the player to have to actually tap the D-pad left or right to manually adjust speed. The problem I'm having is, when any other button is pressed while the D-pad is held in either direction, it retriggers the event input of the D-pad. For example, if I'm already holding right on the D-pad and I press the X button, the console prints "move right" and the player's x speed increases, which should not happen, since I have not retapped the D-pad. Is there perhaps a more relevant input function that I should be using in this case? Or a way to prevent that retriggering?