So I'm creating a simple 2D breakout game and I have instanced the bricks in code. I created somewhat of a grid of bricks but the problem is that when the ball hits any one of the bricks then all the bricks are gone/deleted.
var pos_x = 64
var pos_y = 0
for i in range(row):
pos_y += 32
pos_x = 64
for j in range(column):
brick = BRICK_SCENE.instance()
brick.position = Vector2(pos_x, pos_y)
pos_x += 64
#Rigidbody2D Ball uses signal body_entered and deletes brick
The bricks are ordered in rows and columns so 'spawn_bricks(3,5)' would spawn 3 rows of 5 bricks. Is there any way where if the ball collided with one brick then that brick is deleted and not the whole grid.