0 votes

Hello, I've made a bullet from an area2d and I've created the signal for when a body enters the bullet I do queuefree() and body.queuefree(). 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?

in Engine by (14 points)

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?

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

1 Answer

0 votes

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

by (59 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.