The Path Enemies Are Not Fully Deleted If Shot

In the project, Path Enemies will die if they hit the end of the path because their code calls queue_free() when hitting the progress ratio.

Unfortunately, because getting shot does not complete the path, the die() triggered from the enemy scene will only free the enemy instance within the Path Enemy from queue.

This leaves behind a bunch of stray Path2Ds and PathFollow2Ds from the ones that get shot.

To fix this, just connect the died() signal from the enemy instance in the PathEnemy hierarchy to the Path2D node and call queue_free() from there.

In the node inspector for the enemy scene inside of the path_enemy scene:
image

In the script for the path_enemy:
image

Now when the enemies die, the path dies. Hope this helps!

1 Like

Ah, nice spot. I Didnt think to even check if the parent was still there.

Cheers for that :+1:

1 Like

No problem. Happy it helps! Also at least it’s proof that all of the GDTV courses are working that I can even catch stuff like this now. Haha. :sunglasses:

Privacy & Terms