![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | i.want.to.die |
so i have this code:
player:
func on_hit(damage):
$Sprite.play("dano")
current_hp -= damage
if current_hp <= 0:
ply_dead()
func ply_dead():
$CollisionShape2D.queue_free()
is_dead = true
motion.x = 0
$Sprite.play("dead")
$Timer.start()
enemy:
func _on_Area2D_body_entered(body):
body.on_hit(damage)
it only hits the plyer becouse of collision masks
the animation ‘dano’ does not play when the ply_dead function is atcivated on the enemy’s code
how can i fix this?