comparison pytouhou/game/game.pyx @ 497:3da7395f39e3

Make enemy callbacks programmables.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Mon, 14 Oct 2013 12:20:55 +0200
parents 6be9c99a3a24
children 3d3285918ba1
comparison
equal deleted inserted replaced
496:104c737ce8b3 497:3da7395f39e3
201 for enemy in self.enemies: 201 for enemy in self.enemies:
202 if enemy.boss: 202 if enemy.boss:
203 pass # Bosses are immune to 96 203 pass # Bosses are immune to 96
204 elif enemy.touchable: 204 elif enemy.touchable:
205 enemy.life = 0 205 enemy.life = 0
206 elif enemy.death_callback > 0: 206 else:
207 #TODO: check 207 #TODO: check
208 enemy.process.switch_to_sub(enemy.death_callback) 208 enemy.death_callback.fire()
209 enemy.death_callback = -1
210 209
211 210
212 cpdef new_effect(self, pos, long anim, anm=None, long number=1): 211 cpdef new_effect(self, pos, long anim, anm=None, long number=1):
213 number = min(number, self.nb_bullets_max - len(self.effects)) 212 number = min(number, self.nb_bullets_max - len(self.effects))
214 for i in xrange(number): 213 for i in xrange(number):