pause on unfocused

This commit is contained in:
Haze Weathers 2024-02-27 23:10:05 -05:00
parent 0fadeb7998
commit 96b2b2a804
2 changed files with 18 additions and 0 deletions

View file

@ -6,6 +6,16 @@ export var cutscene_skip: float = 92.0
onready var animation_player: AnimationPlayer = $AnimationPlayer onready var animation_player: AnimationPlayer = $AnimationPlayer
func _init() -> void:
connect("cutscene_finished", self, "_on_cutscene_finished")
func _on_cutscene_finished() -> void:
Game.can_pause = true
func _physics_process(delta: float) -> void:
if animation_player.current_animation_position < cutscene_skip:
Game.can_pause = false
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
if event.is_action_pressed("jump") and animation_player.current_animation_position < (cutscene_skip - Options.transition_speed_secs * 2.0): if event.is_action_pressed("jump") and animation_player.current_animation_position < (cutscene_skip - Options.transition_speed_secs * 2.0):
skip_cutscene() skip_cutscene()

View file

@ -12,6 +12,14 @@ var time_bonus = true
var life_bonus = true var life_bonus = true
var collectible_bonus = false var collectible_bonus = false
func _notification(what: int) -> void:
match what:
NOTIFICATION_WM_FOCUS_OUT:
if Debug.entry == false and Game.can_pause and not get_tree().paused:
var pause = PauseScreen.instance()
pause.lore_entries = lore_entries
get_parent().call_deferred("add_child", pause)
func _ready(): func _ready():
get_tree().paused = true get_tree().paused = true
Game.can_pause = false Game.can_pause = false