feat: 添加玩家和敌人血条

This commit is contained in:
luke358
2026-05-18 15:46:44 +08:00
parent 2060719f4e
commit b6bf8ef5ba
12 changed files with 180 additions and 0 deletions
+13
View File
@@ -6,3 +6,16 @@ class_name Unit
@onready var visuals: Node2D = %Visuals
@onready var sprite: Sprite2D = %Sprite
@onready var anim_player: AnimationPlayer = $AnimationPlayer
@onready var health_component: HealthComponent = $HealthComponent
func _ready() -> void:
print(stats)
health_component.setup(stats)
func _on_hurtbox_component_on_damaged(hitbox: HitboxComponent) -> void:
if health_component.current_health <=0:
return
health_component.take_damage(hitbox.damage)
print("%s: %d" % [name, health_component.current_health] )