I don't know why my enemy falling off and doesn't play dead animation

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By malaka


func _on_Bullet_body_entered(body):
if "Enemy" in body.name:


func dead():
is_dead = true
velocity = Vector2(0,0)

I wrote this codes via a tutorial and its actually worked but there is some problems in it. In the video he shoots the enemy and enemy play dead animation, removing his collision and stay on the floor but in my game when i shoot the enemy its falling and doesn’t play the dead animation

Try changing
If “Enemy” in body.name
If body.name == “Enemy”

Ogeeice | 2020-05-31 23:08

Same,its still falling down and doesn’t play dead animation

malaka | 2020-06-01 06:07

:bust_in_silhouette: Reply From: Ogeeice

Maybe it’s deleting the body once the animation starts and it’s happening so fast it seems like the animation not playing.maybe delete the body once the animation has finished instead

i dont know how to fix this also in the tutorial everything works and is there a any solve to falling down from walls

malaka | 2020-06-01 14:49

i mean its not freeze when he dies

malaka | 2020-06-01 14:53

Ok try removing the queue_free() and see if it works. Then if it does play the animation move the queue_free() to under the timer

Ogeeice | 2020-06-02 13:11