15 lines
217 B
GDScript3
Raw Normal View History

2024-01-18 22:35:17 +00:00
class_name HealthComponent
extends Node
@export var max_health: float
var health: float
func _ready():
pass
func take_damage(attack: Attack):
health -= attack.damage
if health <= 0:
get_parent().queue_free()