0 votes

Is there a way to do this in GD script rather than getting is_key_pressed is there something along the lines of is_key_released?

in Engine by (483 points)

2 Answers

+8 votes

Call set_process_input(true) inside your _ready function
You can then do this in your_input function, after calling :

func _input(event):
# ...
    if event.type == InputEvent.KEY:
    # ...
        if event.scancode == KEY_W && event.pressed == false:
        # The 'W' key was released
by (79 points)
+3 votes

Use actions instead of hard coding keys. Then just do:

func _input(event):
    if event.is_action_released("my_action"):

and for key pressed use if event.is_action_pressed()

by (543 points)
edited by
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 Frequently asked questions and 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 [email protected] with your username.