Commits

Anonymous committed 17622e8

Working on issue 6

  • Participants
  • Parent commits 7f5c150

Comments (0)

Files changed (1)

pypong-clock/ball.py

                 self.rect.move_ip(self.velocity)
                 self.surface.blit(original_background, (0, 0))
                 return
-        
-        # check for top and bottom bounce
-        if t_position.top < 0 + self.top_bottom_offset:	    
-            self.velocity[1] *= -1.0
-            self.need_updated_intercept_position = True
-        # bottom edge bounce
-        elif t_position.bottom > self.surface.get_height() - self.top_bottom_offset:
-            self.velocity[1] *= -1.0
-            self.need_updated_intercept_position = True
 
         #6 Attempt to fix #6 where we have zombie balls with the next two elifs
 
-        elif self.rect.left > self.surface.get_width() + 40:  # #6 should not happen
+        if self.rect.left > self.surface.get_width() + 40:  # #6 should not happen
             self.rect.top = (self.surface.get_height()/2)
             self.rect.left = (self.surface.get_width()/2)
             #set the new velocity to a random between initial and max
             self.velocity[0] *= -1.0  # change direction
             self.need_updated_intercept_position = True
 
+        # check for top and bottom bounce
+        if t_position.top < 0 + self.top_bottom_offset:	    
+            self.velocity[1] *= -1.0
+            self.need_updated_intercept_position = True
+        # bottom edge bounce
+        elif t_position.bottom > self.surface.get_height() - self.top_bottom_offset:
+            self.velocity[1] *= -1.0
+            self.need_updated_intercept_position = True
+
         # What happens if we're off screen here?
 
         #Check to see if we score