Mercurial > touhou
comparison pytouhou/game/enemy.py @ 220:0595315d3880
Fix SHT handling; change a few things to be closer to ZUN’s mind; and first stub of PCB support.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 18 Dec 2011 14:14:32 +0100 |
parents | 78e9957ad344 |
children | 3cbfa2c11dec 1de67f332f00 |
comparison
equal
deleted
inserted
replaced
219:091301805cce | 220:0595315d3880 |
---|---|
239 | 239 |
240 # Check for enemy-bullet collisions | 240 # Check for enemy-bullet collisions |
241 for bullet in self._game.players_bullets: | 241 for bullet in self._game.players_bullets: |
242 half_size = bullet.hitbox_half_size | 242 half_size = bullet.hitbox_half_size |
243 bx, by = bullet.x, bullet.y | 243 bx, by = bullet.x, bullet.y |
244 bx1, bx2 = bx - half_size, bx + half_size | 244 bx1, bx2 = bx - half_size[0], bx + half_size[0] |
245 by1, by2 = by - half_size, by + half_size | 245 by1, by2 = by - half_size[1], by + half_size[1] |
246 | 246 |
247 if not (bx2 < ex1 or bx1 > ex2 | 247 if not (bx2 < ex1 or bx1 > ex2 |
248 or by2 < ey1 or by1 > ey2): | 248 or by2 < ey1 or by1 > ey2): |
249 bullet.collide() | 249 bullet.collide() |
250 damages += bullet._bullet_type.damage | 250 damages += bullet.damage |
251 self.drop_particles(1, 1) | 251 self.drop_particles(1, 1) |
252 | 252 |
253 # Check for enemy-player collisions | 253 # Check for enemy-player collisions |
254 ex1, ex2 = ex - ehalf_size_x * 2. / 3., ex + ehalf_size_x * 2. / 3. | 254 ex1, ex2 = ex - ehalf_size_x * 2. / 3., ex + ehalf_size_x * 2. / 3. |
255 ey1, ey2 = ey - ehalf_size_y * 2. / 3., ey + ehalf_size_y * 2. / 3. | 255 ey1, ey2 = ey - ehalf_size_y * 2. / 3., ey + ehalf_size_y * 2. / 3. |