project_teddy/scripts/death.gd

22 lines
510 B
GDScript

extends Node
var deathTimer = 0
var teddyNode
func _ready():
pass
func _process(delta):
#teddyNode = get_node(Global.selfTeddy)
Global.playerAlive = false
#teddyNode.visible = 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