extends VBoxContainer func _ready() -> void: toggle_hud() # This should hide the HUD by default func _process(delta: float) -> void: if Input.is_action_just_pressed("ui_cancel"): toggle_hud() func toggle_hud() -> void: var should_show = Input.mouse_mode == Input.MOUSE_MODE_CAPTURED if should_show: Input.mouse_mode = Input.MOUSE_MODE_VISIBLE show() else: Input.mouse_mode = Input.MOUSE_MODE_CAPTURED hide() func _on_menu_button_pressed() -> void: var err = get_tree().change_scene_to_file("res://menu.tscn") if err != OK: print("Failed to switch scenes: ", error_string(err))