Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | malaka |
Bullet
func _on_Bullet_body_entered(body):
if "Enemy" in body.name:
body.dead()
queue_free()
Enemy
func dead():
is_dead = true
velocity = Vector2(0,0)
$AnimatedSprite.play("dead")
$CollisionShape2D.set_deferred("disabled",true)
$Timer.start()
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
To
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