Tough_Crowd/godot/scenes/ingame_scene.gd

23 lines
555 B
GDScript3
Raw Normal View History

2024-01-26 18:01:32 +00:00
extends Node2D
@onready var fade_overlay = %FadeOverlay
@onready var pause_overlay = %PauseOverlay
func _ready() -> void:
fade_overlay.visible = true
if SaveGame.has_save():
SaveGame.load_game(get_tree())
pause_overlay.game_exited.connect(_save_game)
func _input(event) -> void:
if event.is_action_pressed("pause") and not pause_overlay.visible:
get_viewport().set_input_as_handled()
get_tree().paused = true
pause_overlay.grab_button_focus()
pause_overlay.visible = true
func _save_game() -> void:
SaveGame.save_game(get_tree())