def __init__(self): super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE) # Set the working directory (where we expect to find files) to the same # directory this .py file is in. You can leave this out of your own # code, but it is needed to easily run the examples using "python -m" # as mentioned at the top of this program. file_path = os.path.dirname(os.path.abspath(__file__)) os.chdir(file_path) arcade.set_background_color(arcade.color.BLACK) # collect particle factory functions self.factories = [ v for k, v in globals().items() if k.startswith("emitter_") ] self.emitter_factory_id = -1 self.label = None self.emitter = None self.obj = arcade.Sprite("images/bumper.png", 0.2, center_x=0, center_y=15) self.obj.change_x = 3 self.frametime_plotter = arcade.FrametimePlotter() pyglet.clock.schedule_once(self.next_emitter, QUIET_BETWEEN_SPAWNS)
def __init__(self): super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE) # Set the working directory (where we expect to find files) to the same # directory this .py file is in. You can leave this out of your own # code, but it is needed to easily run the examples using "python -m" # as mentioned at the top of this program. file_path = os.path.dirname(os.path.abspath(__file__)) os.chdir(file_path) self.emitter = make_emitter() arcade.set_background_color(arcade.color.BLACK) self.frametime_plotter = arcade.FrametimePlotter()
def __init__(self): super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE) # Set the working directory (where we expect to find files) to the same # directory this .py file is in. You can leave this out of your own # code, but it is needed to easily run the examples using "python -m" # as mentioned at the top of this program. file_path = os.path.dirname(os.path.abspath(__file__)) os.chdir(file_path) arcade.set_background_color(arcade.color.BLACK) self.emitters = [] self.frametime_plotter = arcade.FrametimePlotter() self.launch_firework(0) arcade.schedule(self.launch_spinner, 4.0) stars = arcade.Emitter( pos=Vec2d.zero(), emit_controller=arcade.EmitMaintainCount(20), particle_factory=lambda emitter: AnimatedAlphaParticle( filename_or_texture=random.choice(STAR_TEXTURES), vel=Vec2d.zero(), start_alpha=0, duration1=random.uniform(2.0, 6.0), mid_alpha=128, duration2=random.uniform(2.0, 6.0), end_alpha=0, pos=arcade.rand_in_rect(Vec2d.zero(), SCREEN_WIDTH, SCREEN_HEIGHT))) self.emitters.append(stars) self.cloud = arcade.Emitter( pos=Vec2d(50, 500), vel=Vec2d(0.15, 0), emit_controller=arcade.EmitMaintainCount(60), particle_factory=lambda emitter: AnimatedAlphaParticle( filename_or_texture=random.choice(CLOUD_TEXTURES), vel=arcade.rand_in_circle(Vec2d.zero(), 0.04) + Vec2d(0.1, 0), start_alpha=0, duration1=random.uniform(5.0, 10.0), mid_alpha=255, duration2=random.uniform(5.0, 10.0), end_alpha=0, pos=arcade.rand_in_circle(Vec2d.zero(), 50))) self.emitters.append(self.cloud)