2023-01-31 13:34:11 -07:00
|
|
|
extends Node
|
|
|
|
|
|
|
|
var deathTimer = 0
|
2023-02-23 10:19:37 -07:00
|
|
|
var teddyNode
|
2023-01-31 13:34:11 -07:00
|
|
|
|
|
|
|
func _ready():
|
2023-03-06 00:35:22 -07:00
|
|
|
Global.playerAlive = false
|
|
|
|
if Global.roundInSession:
|
|
|
|
Global.HUDPlayerDied = true
|
2023-01-31 13:34:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
func _process(delta):
|
2023-03-16 13:37:17 -06:00
|
|
|
if Global.gamemode == "Runner":
|
2023-03-28 22:32:49 -06:00
|
|
|
if Global.iAmSpecial:
|
2023-04-04 12:39:23 -06:00
|
|
|
Global.specialDead = true
|
2023-03-28 22:32:49 -06:00
|
|
|
if Global.gamemode == "TTT":
|
|
|
|
if not Global.iAmSpecial and Global.roundInSession:
|
|
|
|
Global.iAmDeadAndInnocent = true
|
|
|
|
return
|
|
|
|
elif Global.iAmSpecial:
|
|
|
|
Global.specialDead = true
|
2023-01-31 13:34:11 -07:00
|
|
|
if deathTimer < 100:
|
2023-03-06 19:07:22 -07:00
|
|
|
deathTimer = deathTimer + (10 * Global.respawnTimeModifier) * delta
|
2023-01-31 13:34:11 -07:00
|
|
|
if deathTimer > 100:
|
|
|
|
deathTimer = 0
|
2023-05-16 11:52:29 -06:00
|
|
|
Global.playerDeathHealth = 100
|
2023-01-31 13:34:11 -07:00
|
|
|
Global.playerPleaseRespawn = true # Used so the Teddy script will know to reset variables and position of the player
|
|
|
|
self.queue_free()
|
|
|
|
$deathBar.value = deathTimer
|
2023-05-16 10:00:28 -06:00
|
|
|
if Input.is_action_pressed("start_game"):
|
|
|
|
Global.playerDeathHealth = $deathBar.value
|
|
|
|
Global.playerPleaseRespawn = true
|
|
|
|
self.queue_free()
|