+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?

asked Oct 20, 2016 in Engine by blank (130 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")
answered Oct 20, 2016 by ericdl (1,284 points)
selected Oct 21, 2016 by blank
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.

answered Oct 21, 2016 by eons (7,764 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.