Mercurial > touhou
comparison pytouhou/game/enemy.py @ 294:94c636f8f863
Add player lasers for MarisaB.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Tue, 21 Feb 2012 14:28:38 +0100 |
parents | dbb1a86c0235 |
children | da53bc29b94a |
comparison
equal
deleted
inserted
replaced
293:ab618c2bbce8 | 294:94c636f8f863 |
---|---|
284 bullet.collide() | 284 bullet.collide() |
285 if self.damageable: | 285 if self.damageable: |
286 damages += bullet.damage | 286 damages += bullet.damage |
287 self.drop_particles(1, 1) | 287 self.drop_particles(1, 1) |
288 | 288 |
289 # Check for enemy-laser collisions | |
290 for laser in self._game.players_lasers: | |
291 if not laser: | |
292 continue | |
293 | |
294 half_size = laser.hitbox_half_size | |
295 lx, ly = laser.x, laser.y * 2. | |
296 lx1, lx2 = lx - half_size[0], lx + half_size[0] | |
297 | |
298 if not (lx2 < ex1 or lx1 > ex2 | |
299 or ly < ey1): | |
300 if self.damageable: | |
301 damages += laser.damage | |
302 self.drop_particles(1, 1) | |
303 | |
289 # Check for enemy-player collisions | 304 # Check for enemy-player collisions |
290 ex1, ex2 = ex - ehalf_size_x * 2. / 3., ex + ehalf_size_x * 2. / 3. | 305 ex1, ex2 = ex - ehalf_size_x * 2. / 3., ex + ehalf_size_x * 2. / 3. |
291 ey1, ey2 = ey - ehalf_size_y * 2. / 3., ey + ehalf_size_y * 2. / 3. | 306 ey1, ey2 = ey - ehalf_size_y * 2. / 3., ey + ehalf_size_y * 2. / 3. |
292 if self.collidable: | 307 if self.collidable: |
293 for player in self._game.players: | 308 for player in self._game.players: |