This commit is contained in:
Nyx
2025-08-26 13:24:16 -06:00
57 changed files with 5143 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
extends Node
class_name HealthComponenent
signal hp_changed(current_hp)
signal died()
@export var data: HealthResource
var current_hp: float
func _ready() -> void:
current_hp = data.max_hp
func _take_damage(amount:float )->void:
current_hp = max(current_hp-amount,0)
emit_signal(&"hp_changed", current_hp)
if current_hp == 0:
emit_signal(&"died")
func _heal(amount:float)->void:
current_hp= min(current_hp+amount, data.max_hp)
emit_signal(&"hp_changed",current_hp)

View File

@@ -0,0 +1 @@
uid://gihel4imt7xk