I need help i have a problem and dont know why

Godot Version

godot-4

Question

I made a subscene named collectibles (cherries) and I wanted when my character touches the cherry the cherry disappears. I gave my collectable subscene the body_entered signal and wrote queue_free() in the script instead of pass. It should work but when I turn on the game all the cherries disappear automatically without touching them.

Maybe something in your level is colliding with them? Are they touching any physics body’s?

1 Like

create group name character in character

and chery signal look like this:

func _on_body_entered(body):
    if body.is_in_group("character"):
        queue_free()
2 Likes

The way you wrote your code, if any body enters, the cherry will disappear.

You should instead check if the body entered is the player

1 Like