comparison pytouhou/game/enemy.py @ 190:dbe6b7b2d3fc

Fix a few things about particles.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 27 Oct 2011 15:09:42 -0700
parents 54eb6b254b7b
children 9f58e2a6e950
comparison
equal deleted inserted replaced
189:ba3297ab3bde 190:dbe6b7b2d3fc
167 167
168 168
169 def on_attack(self, bullet): 169 def on_attack(self, bullet):
170 if self.damageable: 170 if self.damageable:
171 self.life -= bullet._bullet_type.damage 171 self.life -= bullet._bullet_type.damage
172 self._game.new_particle((self.x, self.y), 1, 3., 192) #TODO: find the real size and range. 172 self.drop_particles(1, 1)
173 173
174 174
175 def on_collide(self): 175 def on_collide(self):
176 self.life -= 80 # found experimentally 176 self.life -= 80 # found experimentally
177 177
178 178
179 def die_anim(self): 179 def die_anim(self):
180 self._game.new_death((self.x, self.y), self.death_anim) 180 self._game.new_death((self.x, self.y), self.death_anim)
181 #TODO: 8 white particles are used only in stage 3 to 6, 181
182 # in other stages they are 2 red and 6 blue. 182
183 for i in range(8): 183 def drop_particles(self, number, color):
184 self._game.new_particle((self.x, self.y), 0, 3., 192) #TODO: find the real size and range. 184 #TODO: white particles are only used in stage 3 to 6,
185 # in other stages they are blue.
186 if color == 0:
187 if self._game.stage in [1, 2, 7]:
188 color = 3
189 for i in range(number):
190 self._game.new_particle((self.x, self.y), color, 4., 256, delay=False) #TODO: find the real size.
185 191
186 192
187 def set_pos(self, x, y, z): 193 def set_pos(self, x, y, z):
188 self.x, self.y = x, y 194 self.x, self.y = x, y
189 self.interpolator = Interpolator((x, y)) 195 self.interpolator = Interpolator((x, y))