title: How to make a ball go around the edge of the screen continuously? (Python 2.7)
body: <p>I need help with my animation code. So far i have the ball go around 3 edges of the screen. But i don't know how to make it go around the last screen. </p>
  
  <pre><code>#-------------------------------------------------------------------------------
  # Name:        U1A4.py
  # Purpose:     To animate the ball going around the edge of the screen
  #-------------------------------------------------------------------------------
  
  import pygame
  import sys
  pygame.init()
  
  # Screen
  screenSize = (800,600)
  displayScreen = pygame.display.set_mode(screenSize,0)
  pygame.display.set_caption("Animation Assignment 1")
  
  # Colours
  WHITE = (255,255,255)
  GREEN = (0,255,0)
  RED = (255,0,0)
  BLUE = (0,0,255)
  
  displayScreen.fill(WHITE)
  pygame.display.update()
  
  # ----------------- Leave animation code here ---------------------------------#
  
  # THU/09/29
  # Need to complete the last turn with the ball
  
  x = 50
  y = 50
  dx = 0
  dy = 2
  stop = False
  while not stop:
      for event in pygame.event.get():
          if event.type ==pygame.QUIT:
              stop = True
  
      displayScreen.fill(WHITE)
  
      x = x + dx
      y = y + dy
  
      if (x&gt;=750):
              dx = 0
              dy = -2
  
      if (y&gt;=550)and dy&gt;0:
              dy = 0
              dx = 2
  
      if (x&gt;=750)and dy&gt;0:
              dy = 0
              dx = 2
  
      if (y&gt;=550)and dy&gt;0:
              dx = 0
              dy = -2
  
  
      pygame.draw.circle(displayScreen, GREEN, (x,y),50, 0)
      pygame.display.update()
  
  pygame.quit()
  sys.exit()
  </code></pre>
  
  <p>The ball needs to go around the border of the screen continuously, any hints or direct answers are welcome. Thanks.</p>