コード例 #1
0
ファイル: particle_systems.py プロジェクト: Hoyin7123/2048
def emitter_10():
    """Burst, emit from center, velocity from angle with spread"""
    e = arcade.Emitter(
        center_xy=CENTER_POS,
        emit_controller=arcade.EmitBurst(BURST_PARTICLE_COUNT // 4),
        particle_factory=lambda emitter: arcade.LifetimeParticle(
            filename_or_texture=TEXTURE,
            change_xy=arcade.rand_vec_spread_deg(90, 45, 2.0),
            lifetime=DEFAULT_PARTICLE_LIFETIME,
            scale=DEFAULT_SCALE,
            alpha=DEFAULT_ALPHA
        )
    )
    return emitter_10.__doc__, e
コード例 #2
0
 def __init__(self, center_position: Tuple[float, float]):
     """
     :param center_position: tuple of x and y coordinates
     """
     super().__init__(
         center_xy=center_position,
         emit_controller=arcade.EmitInterval(0.003),
         particle_factory=lambda emitter: arcade.LifetimeParticle(
             filename_or_texture=
             ":resources:images/pinball/pool_cue_ball.png",
             change_xy=arcade.rand_vec_spread_deg(180, 25, 1.0),
             lifetime=random.uniform(self.PARTICLE_LIFETIME - 1.0, self.
                                     PARTICLE_LIFETIME),
             scale=0.1,
             alpha=32))
コード例 #3
0
 def generate_smoke(self):
     """
     Particle generator to create smoking wreck
     """
     offset = random.randint(-10, 10)
     smoke = arcade.Emitter(
         center_xy=(self.center_x + offset, self.center_y + offset),
         emit_controller=arcade.EmitMaintainCount(50),
         particle_factory=lambda emitter: arcade.FadeParticle(
             filename_or_texture=self.texture_smoke,
             change_xy=arcade.rand_vec_spread_deg(90, 20, 2),
             lifetime=random.random() * 2,
         ),
     )
     self.emitter = smoke
     return smoke
コード例 #4
0
ファイル: utils.py プロジェクト: nekitdev/red_green_blue
def dash_emitter_factory(color, pos_a, pos_b):
    """Interval, emit on line"""
    logging.info("Creating dash emitter")

    if pos_a[0] > pos_b[0]:
        angle = 0
    else:
        angle = 180
    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.EmitterIntervalWithTime(LINE_EMIT_INTERVAL,
                                                       DEFAULT_EMIT_DURATION),
        particle_factory=lambda emitter: arcade.LifetimeParticle(
            filename_or_texture=random.choice(textures),
            change_xy=arcade.rand_in_circle((0.0, 0.0), PARTICLE_SPEED_SLOW),
            lifetime=DEFAULT_PARTICLE_LIFETIME,
            center_xy=arcade.rand_on_line(pos_a, pos_b),
            scale=LINE_SCALE,
            alpha=DEFAULT_ALPHA,
        ),
    )
    exhaust_plume_e = arcade.Emitter(
        center_xy=pos_a,
        emit_controller=arcade.EmitterIntervalWithTime(PLUME_EMIT_INTERVAL,
                                                       PLUME_EMIT_DURATION),
        particle_factory=lambda emitter: arcade.FadeParticle(
            filename_or_texture=random.choice(textures),
            change_xy=arcade.rand_vec_spread_deg(angle, 25, 4.0),
            lifetime=PLUME_PARTICLE_LIFETIME,
            scale=PLUME_SCALE,
        ),
    )
    return line_e, exhaust_plume_e
コード例 #5
0
ファイル: test_utils.py プロジェクト: uguronlar/arcade
def test_rand_vec_spread_deg():
    """Smoke test"""
    arcade.rand_vec_spread_deg(-45.0, 5.0, 3.3)