Skip to content

Commit

Permalink
Fix player can unpause the game when dead
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanLovato committed Nov 14, 2019
1 parent d85e0b5 commit 286b878
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions game/src/UserInterface/UserInterface.gd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ onready var pause_overlay: ColorRect = $PauseOverlay
onready var title_label: Label = $PauseOverlay/Title
onready var main_screen_button: Button = $PauseOverlay/PauseMenu/MainScreenButton

const MESSAGE_DIED: = "You died"

var paused: = false setget set_paused


Expand All @@ -18,11 +20,11 @@ func _ready() -> void:

func _on_Player_died() -> void:
self.paused = true
title_label.text = "You died"
title_label.text = MESSAGE_DIED


func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed("pause"):
if event.is_action_pressed("pause") and title_label.text != MESSAGE_DIED:
self.paused = not self.paused


Expand Down

0 comments on commit 286b878

Please sign in to comment.