Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | bgegg |
i want get status of press
pressed=true
relesed=false
if Input.is_key_pressed(KEY_A):
print(“hoge”)
↑i want get status of while pressed
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | bgegg |
i want get status of press
pressed=true
relesed=false
if Input.is_key_pressed(KEY_A):
print(“hoge”)
↑i want get status of while pressed
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:
print("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