Trying to make an enemy death in Godot

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

Hey everyone!

I’ve been trying to make an enemy death occur when a bullet shoots at the enemy. Basically, I’ve used a prefab for shooting bullets, so there can be an infinite amount of bullets to be shot.

I’ve been trying all day, but whenever a bullet hits the enemy, nothing happens at all. So, take a look at my code and let me know where/if I’ve gone wrong, in the screenshots at the bottom of this post.

For additional context, the “”, and the “die” animation is there, because I’m using an area 2D for both the player death, as well as the bullet shot. (I really hope this makes sense!)

When both the player collides with the enemy (aka, the “Karen”), the game over screen appears. This is scene on line 16 of

I’ve done this on line 19, but the same result does not happen. If you look at line 5, the “Bullet” variable is made for the prefab.

Overall, what I’m trying to do, is make the enemy play an animation, when it is hit by the bullet. I’m not sure if this isn’t working due to the bullet being a prefab, or something else. Any tips, fixes, or alternate code or tutorials is much appreciated. Thank you so much!

PHOTO DESC ONE - ![“Dead” script, holds enemy death from bullet, and player collision/game over screen as well][1]

PHOTO DESC TWO - ![Code used for bullet][2]

PHOTO DESC THREE- ![This is the bullet itself][3]

PHOTO DESC FOUR - ![And here is my enemy, who in this case is a Karen][4]

PHOTO ONE - [1]:

PHOTO TWO - [2]:


:bust_in_silhouette: Reply From: exuin

Not sure if someone on Reddit has answered this for you already, but “Karen” is not a body, it’s an Area. So you need to connect the area_entered signal instead.