title: Colour Changing Bouncing Ball
body: <p>I'm working on a project to make an animation in pygame. The assignment is this: </p>
  
  <blockquote>
    <p>Add 2 other balls to the screen (3 in total) that will all be different colors, different sizes and start in different directions. They will all bounce around continuously.</p>
    
    <p>Hint: you will need to create all new variables for each ball<br>
    i.e.  x2,y2, dx2, dy2<br>
    and you will need to check each ball individually for hitting a wall and update the vertical and horizontal position of each ball individually.</p>
    
    <p>Level 4 Challenge: when the balls hit the wall and the colors change to make each color randomly change.</p>
  </blockquote>
  
  <p>Here is my code so far, I am using Python 3.7 on a Mac. The code so far has the first ball bouncing and staying the same color. I can't figure out how to make two more balls and have them change color each time they hit a wall. If someone could please help I literally cannot figure this out.</p>
  
  <pre><code>import pygame
  import sys
  pygame.init()
  
  screensize = (800,600)
  screen = pygame.display.set_mode(screensize,0)
  pygame.display.set_caption("Animation Test")
  
  WHITE = (255,255,255)
  GREEN = (0,255,0)
  BLUE = (0,0,255)
  RED = (255,0,0)
  
  screen.fill(WHITE)
  pygame.display.update()
  
  
  x = 100
  y = 200
  dx = 2
  dy = 2
  go = True
  while go:
      for event in pygame.event.get():
          if event.type ==pygame.QUIT:
              go = False
  
      screen.fill(WHITE)
  
      x = x + dx
      y = y + dy
      Colour = BLUE 
  
      if (x&gt;=775):
              dx = -dx
      elif (x&gt;=775):
          dx = -dx
      Colour = RED
  </code></pre>