def spawn_particles(self, x, y, number): for i in xrange(number): size = choice([2, 4, 6, 8, 10]) particle = Particle(x, y, size, size, ASSET.particle) particle.image = particle.image.convert() particle.multiplier = 3 particle.frame = -64 particle.fade = False self.particles.add(particle) #particle.collision_group = self.player1.collision_group.copy() particle.splash_group = self.player1.collision_group.copy()
def spawn_player_debris(self, x, y, image, number): for i in xrange(number): size = choice([2, 4, 6, 8, 10]) debris = Particle(x, y, size, size, image) debris.hspeed = choice([-5, -4, -3, -2, 2, 3, 4, 5]) debris.vspeed = choice([-5, -4, -3, -2, 2, 3, 4, 5]) debris.hspeed *= 1.5 debris.vspeed *= 1.5 debris.gravity = 0 debris.fade = True debris.friction = 0.010 * 2 self.particles.add(debris)
def restructure_player(self, x, y, image, number, sprite_group, kill_time): for i in xrange(number): size = choice([2, 4, 6, 8, 10]) debris = Particle(x, y, size, size, image) debris.hspeed = choice([-4, -3, -2, 2, 3, 4]) debris.vspeed = choice([-4, -3, -2, 2, 3, 4]) debris.gravity = 0 debris.fade = False for i in range(GAME.fps/2): debris.fade = False debris.update() debris.timeout = 0 debris.multiplier = kill_time debris.hspeed = -debris.hspeed debris.vspeed = -debris.vspeed self.particles.add(debris) sprite_group.add(debris)