comparison pytouhou/game/enemy.py @ 210:f5be441d2c42

Implement collidable boolean of enemy.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 22 Nov 2011 20:51:35 +0100
parents 005ea47e11e0
children 78e9957ad344
comparison
equal deleted inserted replaced
209:005ea47e11e0 210:f5be441d2c42
37 37
38 self.x, self.y = pos 38 self.x, self.y = pos
39 self.life = 1 if life < 0 else life 39 self.life = 1 if life < 0 else life
40 self.max_life = life 40 self.max_life = life
41 self.touchable = True 41 self.touchable = True
42 self.collidable = True
42 self.damageable = True 43 self.damageable = True
43 self.death_flags = 0 44 self.death_flags = 0
44 self.boss = False 45 self.boss = False
45 self.difficulty_coeffs = (-.5, .5, 0, 0, 0, 0) 46 self.difficulty_coeffs = (-.5, .5, 0, 0, 0, 0)
46 self.extended_bullet_attributes = (0, 0, 0, 0, 0., 0., 0., 0.) 47 self.extended_bullet_attributes = (0, 0, 0, 0, 0., 0., 0., 0.)
248 bullet.collide() 249 bullet.collide()
249 damages += bullet._bullet_type.damage 250 damages += bullet._bullet_type.damage
250 self.drop_particles(1, 1) 251 self.drop_particles(1, 1)
251 252
252 # Check for enemy-player collisions 253 # Check for enemy-player collisions
253 if self.touchable: 254 if self.collidable:
254 for player in self._game.players: 255 for player in self._game.players:
255 if not player.state.touchable: 256 if not player.state.touchable:
256 continue 257 continue
257 258
258 px, py = player.x, player.y 259 px, py = player.x, player.y