def __init__(self, total_particles=80, image=None, duration=-1.0, gravity=None, pos_var=None, origin=None, angle=90.0, angle_var=10.0, speed=25.0, speed_var=10.0, tangential_accel=0.0, tangential_accel_var=0.0, radial_accel=5.0, radial_accel_var=0.0, size=40.0, size_var=10.0, life=4.0, life_var=1.0, start_color=None, start_color_var=None, end_color=None, end_color_var=None, emission_rate=None, blend_additive=True, position_type=POSITION_GROUPED): gravity = gravity or batma.Vector2(0, 0) pos_var = pos_var or batma.Vector2(01, 0) start_color = start_color or batma.Color(0.5, 0.5, 0.5, 0.1) start_color_var = start_color_var or batma.Color(0.0, 0.0, 0.0, 0.1) end_color = end_color or batma.Color(0.5, 0.5, 0.5, 0.1) end_color_var = end_color_var or batma.Color(0.0, 0.0, 0.0, 0.1) emission_rate = emission_rate or total_particles / life super(Smoke, self).__init__(total_particles, image, duration, gravity, pos_var, origin, angle, angle_var, speed, speed_var, tangential_accel, tangential_accel_var, radial_accel, radial_accel_var, size, size_var, life, life_var, start_color, start_color_var, end_color, end_color_var, emission_rate, blend_additive, position_type)
def __init__(self, total_particles=7000, image=None, duration=0.1, gravity=None, pos_var=None, origin=None, angle=90.0, angle_var=360.0, speed=70.0, speed_var=40.0, tangential_accel=0.0, tangential_accel_var=0.0, radial_accel=0.0, radial_accel_var=0.0, size=15.0, size_var=10.0, life=5.0, life_var=2.0, start_color=None, start_color_var=None, end_color=None, end_color_var=None, emission_rate=None, blend_additive=False, position_type=POSITION_GROUPED): gravity = gravity if gravity is not None else batma.Vector2(0, -90) pos_var = pos_var or batma.Vector2(0, 0) start_color = start_color or batma.Color(0.7, 0.2, 0.1, 1.0) start_color_var = start_color_var or batma.Color(0.5, 0.5, 0.5, 0.0) end_color = end_color or batma.Color(0.5, 0.5, 0.5, 0.0) end_color_var = end_color_var or batma.Color(0.5, 0.5, 0.5, 0.0) emission_rate = emission_rate or total_particles / life super(Explosion, self).__init__(total_particles, image, duration, gravity, pos_var, origin, angle, angle_var, speed, speed_var, tangential_accel, tangential_accel_var, radial_accel, radial_accel_var, size, size_var, life, life_var, start_color, start_color_var, end_color, end_color_var, emission_rate, blend_additive, position_type)
def __init__(self, total_particles=3000, image=None, duration=-1.0, gravity=None, pos_var=None, origin=None, angle=90, angle_var=20, speed=180, speed_var=50, tangential_accel=0.0, tangential_accel_var=0.0, radial_accel=0.0, radial_accel_var=0.0, size=8.0, size_var=2.0, life=3.5, life_var=1.0, start_color=None, start_color_var=None, end_color=None, end_color_var=None, emission_rate=None, blend_additive=False, position_type=POSITION_GROUPED): gravity = gravity or batma.Vector2(0, -90) pos_var = pos_var or batma.Vector2(0, 0) start_color = start_color or batma.Color(0.5, 0.5, 0.5, 1.0) start_color_var = start_color_var or batma.Color(0.5, 0.5, 0.5, 1.0) end_color = end_color or batma.Color(0.1, 0.1, 0.1, 0.2) end_color_var = end_color_var or batma.Color(0.1, 0.1, 0.1, 0.2) emission_rate = emission_rate or total_particles / life super(Firework, self).__init__(total_particles, image, duration, gravity, pos_var, origin, angle, angle_var, speed, speed_var, tangential_accel, tangential_accel_var, radial_accel, radial_accel_var, size, size_var, life, life_var, start_color, start_color_var, end_color, end_color_var, emission_rate, blend_additive, position_type)
def __init__(self, total_particles=0, image=None, duration=0.0, gravity=None, pos_var=None, origin=None, angle=0.0, angle_var=0.0, speed=0.0, speed_var=0.0, tangential_accel=0.0, tangential_accel_var=0.0, radial_accel=0.0, radial_accel_var=0.0, size=1.0, size_var=0.0, life=1.0, life_var=0.0, start_color=None, start_color_var=None, end_color=None, end_color_var=None, emission_rate=None, blend_additive=False, position_type=POSITION_GROUPED): super(ParticleSystem, self).__init__() if image is None: image = batma.resource.load_image( os.path.join(os.path.dirname(__file__), 'assets', 'fire.png')) elif isinstance(image, basestring): image = batma.resource.load_image(image) if emission_rate is None: if life != 0 and total_particles != 0: emission_rate = total_particles / float(life) else: emission_rate = 1.0 self.total_particles = total_particles self.image = image self.duration = duration self.gravity = gravity or Vector2(0, 0) self.pos_var = pos_var or Vector2(0, 0) self.origin = origin or Vector2(0, 0) self.angle = angle self.angle_var = angle_var self.speed = speed self.speed_var = speed_var self.tangential_accel = tangential_accel self.tangential_accel_var = tangential_accel_var self.radial_accel = radial_accel self.radial_accel_var = radial_accel_var self.size = size self.size_var = size_var self.life = life self.life_var = life_var self.start_color = start_color or batma.Color(0, 0, 0, 0) self.start_color_var = start_color_var or batma.Color(0, 0, 0, 0) self.end_color = end_color or batma.Color(0, 0, 0, 0) self.end_color_var = end_color_var or batma.Color(0, 0, 0, 0) self.emission_rate = emission_rate self.blend_additive = blend_additive self.position_type = position_type self.particle_pos = np.zeros((self.total_particles, 2), np.float32) self.particle_dir = np.zeros((self.total_particles, 2), np.float32) self.particle_rad = np.zeros((self.total_particles, 1), np.float32) self.particle_tan = np.zeros((self.total_particles, 1), np.float32) self.particle_grav = np.zeros((self.total_particles, 2), np.float32) self.particle_color = np.zeros((self.total_particles, 4), np.float32) self.particle_delta_color = np.zeros((self.total_particles, 4), np.float32) self.particle_life = -np.ones((self.total_particles, 1), np.float32) self.particle_size = np.zeros((self.total_particles, 1), np.float32) self.particle_start_pos = np.zeros((self.total_particles, 2), np.float32) self.active = True self.elapsed = 0 self.emit_counter = 0 self.particle_count = 0 self.auto_remove_on_finish = False