title: All rectangles in one iteration of a game loop drawing the same colour despite explicit colour arguments
body: <p>I'm writing a simple toy in Pygame. When you press a key on the home row, it does a little burst of particles.</p>
  
  <pre><code>class Particle():
      x = 0
      y = 0
      size = 0
      colour = (255, 255, 255)
      rect = None
      def __init__(self, x, y, size, colour):
          self.x = x
          self.y = y
          self.size = size
          self.colour = colour # Particle has its own colour 
          self.rect = pygame.Rect(self.x, self.y, self.size, self.size)
  
  class Burst():
      x = 0
      y = 0
      colour = (255, 255, 255)
      count = 0
      sound = None
      particles = []
  
      def __init__(self, x, y, colour, count, sound):
          self.x = x
          self.y = y
          self.colour = colour # Burst has its own colour, too - all its particles should have the same colour as it
          self.count = count
          self.sound = sound
          self.particles.append(Particle(self.x, self.y, 5, self.colour))
  
      def update(self):
          self.particles.append(Particle(random.randint(1, 30) + self.x, random.randint(1, 30) + self.y, 5, self.colour))
      def draw(self):
          global screen
          for p in self.particles:
              pygame.draw.rect(screen, p.colour, p.rect) # This draws the particles with the correct colours
              #pygame.draw.rect(screen, self.colour, (60, 60, 120, 120), 4) # This draws the particles all the same colour
              #screen.fill(p.colour, p.rect) # This draws the particles all the same colour
  </code></pre>
  
  <p>The line you're looking for is in Burst.draw. For some reason, only the uncommented one works correctly. The other two lines, which should be the same as far as I can tell, only draw the first burst's particles correctly. Any subsequent bursts change all particles onscreen to match their colour.</p>
  
  <p>I can provide more code, but there's not much more to it. Basically keypresses add Bursts to an array, and every tick I step through that array calling update() and draw().</p>
  
  <p>Does anyone know what I did wrong, and then accidentally fixed?</p>