Hi!
My game has an inventory screen. You can hover a cursor over each item in the inventory screen. This works fine with the keyboard, but with the gamepad's analog stick, the cursor doesn't move one item at a time - it moves several items at a time, very quickly.

I want to get discreet inputs from the gamepad's analog stick. So, for example, when the player holds right on the analog stick, the cursor will move right exactly once, and will only move again when the player holds the stick in another direction.
Here's the code that handles the player's input for the cursor:
func _input(event):
var input := Vector2.ZERO
if is_visible():
if event.is_action_pressed("mup"):
input.y -= 1
emit_signal("cursor_moved", input)
if event.is_action_pressed("mdown"):
input.y += 1
emit_signal("cursor_moved", input)
if event.is_action_pressed("mleft"):
input.x -= 1
emit_signal("cursor_moved", input)
if event.is_action_pressed("mright"):
input.x += 1
emit_signal("cursor_moved", input)
(The cursor's actual movement is handled in the "oncursormoved" function)
Thank you!