+3 votes
    if (Input.action_press("key_left")):

in fixed process does nothing, is there a way to execute the if statement only on the key press and not execute it over and over while being pressed?

in Engine by (129 points)

This is a similar question, and a similar answer:


2 Answers

+2 votes
Best answer

Monitoring for an event within func _input will work, as long as "key_left" if defined in your input map.

func _ready():

func _input(event):
    if event.is_action_pressed("key_left"): print("left key pressed")
by (1,318 points)
selected by
0 votes

I use this utility:

The development version has Input.is_action_just_pressed and Input.is_action_just_released if you don't care to work with non stable version.

by (7,948 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 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.