Bullet: Track previous X/Y.
[python-bulletml.git] / bulletml / impl.py
index 2c938d2..4dde9fb 100644 (file)
@@ -256,7 +256,7 @@ class Bullet(object):
             return self.direction
         else:
             return math.degrees(
-                math.atan2(self.target.x - self.x, self.target.y - self.y))
+                math.atan2(self.target.x - self.x, self.y - self.target.y))
 
     @property
     def finished(self):
@@ -287,6 +287,8 @@ class Bullet(object):
             created.extend(action.step())
 
         direction = math.radians(self.direction)
+        self.px = self.x
+        self.py = self.y
         self.x += self.mx + math.sin(direction) * self.speed
         self.y += self.my - math.cos(direction) * self.speed