title: Brick Breaker - Brick collision
body: <p>Im making a pygame brick breakout.. I created everything and now im trying to remove the brick when it interacts with the ball. The problem is that the ball hits the brick and the brick dissapears and appears instantly.. Code:</p>
  
  <pre><code>class Bricks(object):
  def __init__(self):
      pass
  
  def draw(self, ball_x, ball_y):
      num_1 = 0
      num_2 = 0
      num_3 = 0
      num_4 = 0
      bricks_1 = [
          (50, 200),
          (200, 200),
          (350, 200),
          (500, 200),
          (650, 200)
          ]
  
      bricks_2 = [
          (50, 150),
          (200, 150),
          (350, 150),
          (500, 150),
          (650, 150)
      ]
  
      bricks_3 = [
          (50, 100),
          (200, 100),
          (350, 100),
          (500, 100),
          (650, 100)
      ]
  
      bricks_4 = [
          (50, 50),
          (200, 50),
          (350, 50),
          (500, 50),
          (650, 50)
      ]
  </code></pre>
  
  <p>Here is where I test the collision: and I call the bricks_1[0] = (1000, 1000) and the brick dissapears and appears.</p>
  
  <pre><code>    if ball_x &gt; bricks_1[0][0] and ball_x-100 &lt; bricks_1[0][0] and ball_y-25 &lt; bricks_1[0][1] and ball_y &gt; bricks_1[0][1]:
          bricks_1.remove(bricks_1[0])
  </code></pre>
  
  <p>Drawing the bricks row by row</p>
  
  <pre><code>    bricks_1 = list(bricks_1)
      for x1 in bricks_1:
          pygame.draw.rect(screen, blue, (bricks_1[num_1][0], bricks_1[num_1][1], 100, 25))
          num_1 += 1
  
      for x2 in bricks_2:
          pygame.draw.rect(screen, red, (bricks_2[num_2][0], bricks_2[num_2][1], 100, 25))
          num_2 += 1
  
      for x3 in bricks_3:
          pygame.draw.rect(screen, green, (bricks_3[num_3][0], bricks_3[num_3][1], 100, 25))
          num_3 += 1
  
      for x4 in bricks_4:
          pygame.draw.rect(screen, black, (bricks_4[num_4][0], bricks_4[num_4][1], 100, 25))
          num_4 += 1
  </code></pre>