Enemy and bullet desapear before hitting visually

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

Hello, I’ve made a bullet from an area2d and I’ve created the signal for when a body enters the bullet I do queue_free() and body.queue_free(). Everything works fine but the bullet and the body (also an area2d) desapear before even hitting visually. The bullet just show up and desapear along with the enemy. Could anyone help me?

Is the collision shape scaled correct? I mean, its the right size of the sprites? Did you scale by the handles and not the node?

gtkampos | 2018-02-15 19:00

Here is an example that does what I think you are trying to do.

https://github.com/beamer159/Collision-Free/archive/master.zip

Below is what the demo looks like. You can see that the bullet hits the body before both are freed.

Bullet hitting body

Beamer159 | 2018-02-16 16:02

:bust_in_silhouette: Reply From: koigx

Add a timer, set timeout to 2-3 seconds, trigger timer.start() after the on_body_enter signal returns true. This short delay will help.