0 votes

I am currently struggling at making my spawning mobs despawn when I hit them with my bullet which are Area2D.
The mobs are RigidBody .
My bullet despawn aswell as my player when they touch the mob but the mob doesnt and I dont know how to make that happen

in Engine by (14 points)

Hi,
you should really show the code you have so we can see what you are doing and why is not working. Or even share the full project if you can. What is usually made is to connect the body_entered signal of the Area2D to a function called _on_RigidBody2D_body_entered and call body.queue_free() from there.

1 Answer

+1 vote

How are you removing the player and the bullet?

In the bullet Area2D, connect the body_entered() signal. Then you'll have a function that gets a reference to the body:

func _on_Bullet_body_entered(body):
    body.queue_free()
by (21,716 points)

I managed to do it myself now and I used body entered for my bullet aswell . But that wasnt my problem . Thank you anyway

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.