fix hit
This commit is contained in:
@@ -9,6 +9,7 @@ extends Node
|
|||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
if health_component:
|
if health_component:
|
||||||
health_component.on_health_change.connect(on_health_change)
|
health_component.on_health_change.connect(on_health_change)
|
||||||
|
health_component.on_death.connect(on_death)
|
||||||
|
|
||||||
if not sprite:
|
if not sprite:
|
||||||
printerr("No sprite assigned!")
|
printerr("No sprite assigned!")
|
||||||
@@ -31,3 +32,9 @@ func on_health_change(delta: float, _total_health: float) -> void:
|
|||||||
activate()
|
activate()
|
||||||
await get_tree().create_timer(hit_duration).timeout
|
await get_tree().create_timer(hit_duration).timeout
|
||||||
deactivate()
|
deactivate()
|
||||||
|
|
||||||
|
|
||||||
|
func on_death() -> void:
|
||||||
|
activate()
|
||||||
|
await get_tree().create_timer(hit_duration).timeout
|
||||||
|
deactivate()
|
||||||
Reference in New Issue
Block a user