def emitter_26():
    """Interval, emit particles every 0.4 seconds and stop after emitting 5"""
    e = arcade.Emitter(
        pos=CENTER_POS,
        emit_controller=arcade.EmitterIntervalWithCount(0.4, 5),
        particle_factory=lambda emitter: arcade.LifetimeParticle(
            filename_or_texture=TEXTURE,
            vel=arcade.rand_in_circle(Vec2d.zero(), PARTICLE_SPEED_FAST),
            lifetime=DEFAULT_PARTICLE_LIFETIME,
            scale=0.6,
            alpha=128))
    return emitter_26.__doc__, e
Exemplo n.º 2
0
def explosion_factory(pos, color):
    logging.info(f"Creating explosion emitter at {pos}")

    textures = [
        arcade.Texture(f"{time.time()}", Image.new("RGBA", (10, 10), p))
        for p in rand_color(color)
    ]

    line_e = arcade.Emitter(
        center_xy=(0.0, 0.0),
        emit_controller=arcade.EmitterIntervalWithCount(
            EXPLOSION_EMIT_INTERVAL, EXPLOSION_NUM_PARTICLE),
        particle_factory=lambda emitter: arcade.FadeParticle(
            filename_or_texture=random.choice(textures),
            change_xy=arcade.rand_in_circle((0.0, 0.0), PARTICLE_SPEED_FAST),
            lifetime=EXPLOSION_PARTICLE_LIFETIME,
            center_xy=pos,
            change_angle=random.uniform(-6, 6),
            scale=EXPLOSION_SCALE,
        ),
    )
    line_e.change_angle = 16
    return line_e