diff pytouhou/game/laser.py @ 278:615c0bb6064b

Fix generation of bullets/items position from lasers.
author Thibaut Girka <thib@sitedethib.com>
date Mon, 06 Feb 2012 19:38:54 +0100
parents f037bca24f2d
children 3539520fff93
line wrap: on
line diff
--- a/pytouhou/game/laser.py
+++ b/pytouhou/game/laser.py
@@ -70,10 +70,10 @@ class Laser(object):
 
     def get_bullets_pos(self):
         #TODO: check
-        offset = self.start_offset
         length = min(self.end_offset - self.start_offset, self.max_length)
+        offset = self.end_offset - length
         dx, dy = cos(self.angle), sin(self.angle)
-        while 0 <= offset - self.start_offset <= length:
+        while self.start_offset <= offset < self.end_offset:
             yield (self.x + offset * dx, self.y + offset * dy)
             offset += 48.