extends Control func _ready(): visible = false func _input(event: InputEvent) -> void: if event is InputEventKey and event.pressed: match(event.keycode): KEY_ESCAPE: visible = not visible if visible: Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) else: Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)