revo-jailbreak/objects/hud/pause_screen.gd
2023-04-13 13:27:24 -04:00

48 lines
1,019 B
GDScript

extends CanvasLayer
var lore_entry: PackedScene = null
onready var options_screen = $OptionsScreen
onready var lore_container = $LoreContainer
# Called when the node enters the scene tree for the first time.
func _ready():
get_tree().paused = true
$Body/Resume.grab_focus()
#Random lore
if lore_entry != null:
var lore = lore_entry.instance()
lore_container.add_child(lore)
func _physics_process(delta):
#Resume with pause button
if Input.is_action_just_pressed("pause"):
queue_free()
get_tree().paused = false
Console.print(get_tree().paused)
func _on_Resume_pressed():
get_tree().paused = false
queue_free()
func _on_Restart_pressed():
Game.call_deferred("restart_level")
get_tree().paused = false
queue_free()
func _on_Settings_pressed():
options_screen.focus()
func _on_ExitLevel_pressed():
get_tree().paused = false
Game.change_map(load("res://maps/level_select.tscn"))
queue_free()
func _on_OptionsScreen_exit():
options_screen.visible = false
$Body/Settings.grab_focus()