project_teddy/scripts/death.gd

19 lines
427 B
GDScript

extends Node
var deathTimer = 0
func _ready():
pass
func _process(delta):
Global.playerAlive = false
if deathTimer < 100:
deathTimer = deathTimer + 10 * delta
if deathTimer > 100:
deathTimer = 0
Global.playerPleaseRespawn = true # Used so the Teddy script will know to reset variables and position of the player
self.queue_free()
Global.playerHealth = 100
Global.fatigue = 100
$deathBar.value = deathTimer