Added respawn logic ... and with it also a complete rehaul of how managing scene instances work to make it work

This commit is contained in:
2026-03-01 15:40:56 +01:00
parent 51ee5029e9
commit 6d8e8e3734
14 changed files with 194 additions and 36 deletions

View File

@@ -103,14 +103,25 @@ func handle_damage(dmg: int, src: Node) -> void:
healthPoints -= dmg
hasiframes = true
invulnerable_cooldown_timer.start()
if healthPoints <= 0:
print("Player died. Respawn button not implemented.")
isAlive = false
if isAlive and healthPoints <= 0:
die()
func collect_resource(damnt: int) -> void:
resources += damnt
print("Resource collected! Total: ", resources)
func die() -> void:
print("Player died.")
isAlive = false
GameManager.switch_scene("respawn")
# TODO: Is this used or should it be removed? (currently unused)
func respawm() -> void:
healthPoints = maxHealth
isAlive = true
hasiframes = true
attack_cooldown_timer.start()