Godot Version
4.2.1
Question
I want to have different death animation from each enemy, but i’m beginner and that’s really hard to find in opensource.
extends Node
class_name HealthComponent
signal dead(killer)
signal damaged
@export var max_health: float
var current_health
func _ready():
if(max_health == 0):
printerr("Did not set health for"+ owner.name)
return
current_health = max_health
func damage(damage_amount: float, killer: Node = null):
current_health = maxf(0.0, current_health - damage_amount)
if (current_health == 0):
dead.emit()
Doe`s that health componnent is ok for it?