How to check if someone presses a key multiple times

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By cobracon

I’m making a game where it is important to press the same button multiple times. But in gdscript I don’t know how to check for this.

:bust_in_silhouette: Reply From: wyattb

You can use this method inside _process(delta):

if Input.is_action_just_pressed("ui_up"):
    # do something
:bust_in_silhouette: Reply From: exuin

You should have a variable that keeps track of how many times the button has been pressed. Increase this variable every time the button is pressed. You can tell when the button is pressed with a signal.

Edit: wait you were looking for a key and not a button node. Okay in that case the concept is the same, just use an input() function