Skip to content

Commit

Permalink
pause menu bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
KishoreKaushal committed Mar 14, 2021
1 parent 9f2e0ec commit 97ad23f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions platformer/src/UserInterface/UserInterface.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ onready var pause_overlay : ColorRect = get_node("PauseOverlay")
onready var score_label : Label = get_node("ScoreLabel")
onready var pause_title : Label = get_node("PauseOverlay/Title")

const DIED_MESSAGE := "You Died!"

var paused := false setget set_paused

Expand All @@ -19,12 +20,12 @@ func update_interface() -> void:


func _on_PlayerData_player_died() -> void:
pause_title.text = "You Died!"
pause_title.text = DIED_MESSAGE
self.paused = true


func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed("pause"):
if event.is_action_pressed("pause") and pause_title.text != DIED_MESSAGE:
self.paused = not paused
scene_tree.set_input_as_handled()

Expand Down

0 comments on commit 97ad23f

Please sign in to comment.