0 votes

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.

Godot version 3.2.2
in Engine by (32 points)

2 Answers

0 votes

You can use this method inside _process(delta):

if Input.is_action_just_pressed("ui_up"):
    # do something

https://docs.godotengine.org/en/stable/classes/class_input.html#class-input-method-is-action-just-pressed

by (719 points)
0 votes

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

by (7,190 points)
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 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 webmaster@godotengine.org with your username.