Various improvements to the demo game mode

This commit is contained in:
Squinternator 2024-04-09 15:15:04 +00:00
parent c16a71ca74
commit 638117c8f5
9 changed files with 57 additions and 41 deletions

View file

@ -11,13 +11,16 @@ func _ready():
area_entered.connect(_on_area_entered)
func damage(amount : int):
health -= amount
if health <= 0:
health = clampf(health - amount, 0.0, max_health)
if health == 0.0:
health_zeroed.emit()
func reset():
func heal_full():
health = max_health
func _on_area_entered(area):
func heal(amount : int):
health = clampf(health + amount, 0.0, max_health)
func _on_area_entered(area : Area3D):
if area is AreaDamageComponent:
damage(area.damage)