How to make "press any key to start"

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

By that I mean instead of is_action_just_pressed(“specific key”)
it would be any key.

1 Like
:bust_in_silhouette: Reply From: Zylann

Use the _input function callback:

func _input(event):
	if event is InputEventKey:
		if event.pressed:
			start()
		
1 Like
:bust_in_silhouette: Reply From: CapybaraWEB

I want to thank Zylann for the answer, I apretiate your time. For me, What did the trick was to check if the button was still visible, to avoid multiple signals. Im doing the 2d tutorial “Dodge the creeps”. God bless

signal start_game

func _on_StartButton_pressed():
$StartButton.hide()
emit_signal("start_game")

func _input(event):
if event is InputEventKey:
	if event.pressed and $StartButton.is_visible_in_tree():
		emit_signal("start_game")
		$StartButton.hide()
2 Likes

hi like button

We have Input.is_anything_pressed() (If anyone comes across this for reference)

1 Like