Mercurial > touhou
comparison 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 |
comparison
equal
deleted
inserted
replaced
277:219edad0f395 | 278:615c0bb6064b |
---|---|
68 self._anmrunner.run_frame() | 68 self._anmrunner.run_frame() |
69 | 69 |
70 | 70 |
71 def get_bullets_pos(self): | 71 def get_bullets_pos(self): |
72 #TODO: check | 72 #TODO: check |
73 offset = self.start_offset | |
74 length = min(self.end_offset - self.start_offset, self.max_length) | 73 length = min(self.end_offset - self.start_offset, self.max_length) |
74 offset = self.end_offset - length | |
75 dx, dy = cos(self.angle), sin(self.angle) | 75 dx, dy = cos(self.angle), sin(self.angle) |
76 while 0 <= offset - self.start_offset <= length: | 76 while self.start_offset <= offset < self.end_offset: |
77 yield (self.x + offset * dx, self.y + offset * dy) | 77 yield (self.x + offset * dx, self.y + offset * dy) |
78 offset += 48. | 78 offset += 48. |
79 | 79 |
80 | 80 |
81 def cancel(self): | 81 def cancel(self): |