#How to delete the exact brick which collided with the ball?

1 messages · Page 1 of 1 (latest)

eager hazel
#

Hello everyone. New to godot trying to make arkanoid game, had trouble with deleting brick on screen. I have scene with brick which i instantiate to main scene and duplicate then to make more bricks. I added them to group and when they're collided with the ball it deletes all of them but i want to delete the exact brick which ball collided. How i can do that?

low siren
#

In your code it looks like you are deleting the collider not the brick. You would need to get a reference to the brick and the do .queue_free() on the brick not just it's collider. Depending on your setup collider.getparent might be all you need but I don't know your full setup.

eager hazel
#

It works if I type each brick as condition to collider but send an error, i guess because my bricks is from another scene and i instantiated them. It has to be another the way to delete the brick the ball collided with rather then just typing all of them in collider == $"../Brick" or collider == $"../Brick2" or collider == $"../Brick3" or collider == $"../Brick4" or collider == $"../Brick5"
The group thing doesn't seem to work or i use them in a wrong way