how to get status of key pressed?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By bgegg

i want get status of press
if Input.is_key_pressed(KEY_A):

↑i want get status of while pressed

:bust_in_silhouette: Reply From: bborncr

The code you suggests works when using the correct methods and placing it in _process:

extends Node

var pressed = false

func _process(delta):
	pressed = Input.is_key_pressed(KEY_A)
	if pressed:
	elif not pressed:
		print("not pressed")

However, this is usually done using Input event handlers and Input mapping.

The Godot “Your First Game” tutorial shows how to do this properly:
Godot 3.1 Your First Game

thanks for comment
i understand it

bgegg | 2019-04-26 10:44