0 votes

I want to know a certain key like KEYA or KEYB is just pressed, but there is a method for checking action Input.is_action_just_pressed() is there any wat to implement is_key_just_pressed()?

asked Jun 2, 2019 in Engine by Thakee Nathees (238 points)

2 Answers

+3 votes
Best answer

Try this:

func _input(event):
    var just_pressed = event.is_pressed() and not event.is_echo()
    if Input.is_key_pressed(KEY_A) and just_pressed:
        do_thing()
answered Jun 3, 2019 by Dlean Jeans (3,893 points)
selected Jun 6, 2019 by Thakee Nathees

This actually works quite well. Thanks dude!

0 votes
answered Jun 2, 2019 by Aspenforest (20 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.