So I'm doing a code, where if the ball(rectangle) hits a brick (rectangle), the brick disappear I did a list of multiple bricks
bricks_list = [brick := Brick(6, brick_y, brick_width,brick_height), # Brick is a class I did
brick := Brick(76, brick_y, brick_width,brick_height)]
for BRICK in bricks_list:
brick_rect = pygame.Rect(BRICK.x, BRICK.y, brick.width, BRICK.height)
if ball_rect.colliderect(brick_rect):
yVel *= -1
bricks_list.remove(BRICK)
else:
brick_rectangle = pygame.draw.rect(screen, LEVELS[BRICK.level], brick_rect)
BUT everytime the ball hits any brick, the brick just vanishes for few milliseconds and reappear just after
I was expecting the brick to disappear and not show on the screen again