I have a simple routine attached to my Player node to show/hide a menu screen when the Enter key is pressed. I can't figure out how to not have it disappear immediately, as the key press seems to register in multiple frames and trigger both "if" statements.
Is there a way to handle input like this without a timer node to space the input events?
func _process(delta):
if Input.is_action_pressed("menu"):
var menu = MenuScene.instance()
if menu.is_inside_tree():
menu.queue_free()
else:
add_child(menu)