33 lines
920 B
GDScript
33 lines
920 B
GDScript
extends Node
|
|
|
|
var deathTimer = 0
|
|
var teddyNode
|
|
|
|
func _ready():
|
|
Global.playerAlive = false
|
|
if Global.roundInSession:
|
|
Global.HUDPlayerDied = true
|
|
|
|
|
|
func _process(delta):
|
|
if Global.gamemode == "Runner":
|
|
if Global.iAmSpecial:
|
|
Global.specialDead = true
|
|
if Global.gamemode == "TTT":
|
|
if not Global.iAmSpecial and Global.roundInSession:
|
|
Global.iAmDeadAndInnocent = true
|
|
return
|
|
elif Global.iAmSpecial:
|
|
Global.specialDead = true
|
|
if deathTimer < 100:
|
|
deathTimer = deathTimer + (10 * Global.respawnTimeModifier) * delta
|
|
if deathTimer > 100:
|
|
deathTimer = 0
|
|
Global.playerDeathHealth = 100
|
|
Global.playerPleaseRespawn = true # Used so the Teddy script will know to reset variables and position of the player
|
|
self.queue_free()
|
|
$deathBar.value = deathTimer
|
|
if Input.is_action_pressed("start_game"):
|
|
Global.playerDeathHealth = $deathBar.value
|
|
Global.playerPleaseRespawn = true
|
|
self.queue_free()
|