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:
@@ -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()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user