class_name HealthComponent extends Node signal value_changed signal death const DEATH_THRESHOLD = 0.01 @export var max_value: float var value: float func _ready(): value = max_value value_changed.emit() func take_damage(attack: DamageInstance): value = clampf(value - attack.damage, 0, max_value) value_changed.emit() if value < DEATH_THRESHOLD: death.emit()