Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Minor changes to the collides_with() method.

  • Loading branch information...
commit 4675c45f72e009cc38c6cfb638969187f2cd8729 1 parent ffde511
Al Sweigart authored August 07, 2012
10  square-shooter/square-shooter_makeover.py
@@ -102,12 +102,12 @@ def is_out(self):
102 102
         """Returns True if the center of the bubble is outside the game map, False if it is on the map."""
103 103
         return not (0 < self.pos.x < 1 and 0 < self.pos.y < 1)
104 104
 
105  
-    def collides_with(self, bubble):
106  
-        """Returns True if this bubble is intersecting with the Bubble2D object passed in for the bubble parameter."""
107  
-        a = abs(self.pos.x - bubble.pos.x)
108  
-        b = abs(self.pos.y - bubble.pos.y)
  105
+    def collides_with(self, other):
  106
+        """Returns True if this bubble is intersecting with the Bubble2D object passed in for the "other" parameter."""
  107
+        a = self.pos.x - other.pos.x
  108
+        b = self.pos.y - other.pos.y
109 109
         distance = math.sqrt(a * a + b * b)
110  
-        return distance < (self.radius + bubble.radius)
  110
+        return distance < (self.radius + other.radius)
111 111
 
112 112
 def random_position():
113 113
     return (random.random() - 0.5) * 3 + 0.5;

0 notes on commit 4675c45

Please sign in to comment.
Something went wrong with that request. Please try again.