Mercurial > touhou
diff pytouhou/game/enemy.py @ 335:2350147cf043
Fix bullet cancellation and removal
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Sun, 01 Jul 2012 11:43:38 +0200 |
parents | 1bb78c469f64 |
children | 94fdb6c782c1 |
line wrap: on
line diff
--- a/pytouhou/game/enemy.py +++ b/pytouhou/game/enemy.py @@ -20,6 +20,7 @@ from pytouhou.game.bullet import Bullet from pytouhou.game.laser import Laser from pytouhou.game.effect import Effect from math import cos, sin, atan2, pi +from pytouhou.game.bullet import LAUNCHED class Enemy(object): @@ -280,6 +281,8 @@ class Enemy(object): # Check for enemy-bullet collisions for bullet in self._game.players_bullets: + if bullet.state != LAUNCHED: + continue half_size = bullet.hitbox_half_size bx, by = bullet.x, bullet.y bx1, bx2 = bx - half_size[0], bx + half_size[0]