def init(window): smoke = StaticEmitter( rate=10, template=Particle( position=(400,100,0), velocity=(0,35,0), color=(0.8,0.8,0.8,0.005), ), deviation=Particle( position=(100,5,0), velocity=(3,6,0), color=(0.05,0.05,0.05,0.0), ) ) default_system.add_global_controller( Lifetime(20), Gravity((0, -2, 0)), Movement(), Fader(fade_in_end=1.5, max_alpha=0.05, fade_out_start=12, fade_out_end=20), ) group1 = ParticleGroup(controllers=[smoke], renderer=PointRenderer(64, SpriteTexturizer(create_point_texture(64, 1)))) pyglet.clock.schedule_interval(default_system.update, (1.0/30.0)) return default_system
def init(window): flame = StaticEmitter( rate=500, template=Particle(position=(300, 25, 0), velocity=(0, 0, 0), color=(1, 1, 1, 1)), position=Line((window.width / 2 - 85, 200, 0), (window.width / 2 + 85, 200, 0)), deviation=Particle(position=(200, 0, 0), velocity=(7, 50, 0), age=0.75), ) default_system.add_global_controller( Lifetime(6), Gravity((0, 20, 0)), Movement(), ColorBlender( [ (0, (0, 0, 0.5, 0)), (0.5, (0, 0, 0.5, 0.2)), (0.75, (0, 0.5, 1, 0.6)), (1.5, (1, 1, 0, 0.2)), (2.7, (0.9, 0.2, 0, 0.4)), (3.2, (0.6, 0.1, 0.05, 0.2)), (4.0, (0.8, 0.8, 0.8, 0.1)), (6.0, (0.8, 0.8, 0.8, 0)), ] ), ) group = ParticleGroup( controllers=[flame], renderer=PointRenderer(64, SpriteTexturizer(create_point_texture(64, 5))) ) pyglet.clock.schedule_interval(default_system.update, (1.0 / 100.0)) pyglet.clock.set_fps_limit(None) return default_system
jet = StaticEmitter( rate=2000, position=disc, template=Particle( color=(1,1,0), ), deviation=Particle( velocity=(0,0,15), up=(0,0,math.pi), color=(0.1, 0.1, 0.1)) ) default_system.add_global_controller( Movement(max_velocity=10), Collector(viewer_plane), Gravity((0,0,15)), Growth(0.17), Fader(fade_in_end=0, max_alpha=0.3, fade_out_start=0, fade_out_end=8.0), ) texture = image.load(os.path.join(os.path.dirname(__file__), 'Particle.bmp')).get_texture() group = ParticleGroup(controllers=[jet], renderer=BillboardRenderer(SpriteTexturizer(texture.id))) default_system.run_ahead(5, 40) pyglet.clock.schedule_interval(default_system.update, (1.0/30.0)) pyglet.clock.set_fps_limit(None) time = 0 def ring(dt):
def init(lokumBorg=None): platform = pyglet.window.get_platform() display = platform.get_default_display() W = 200 H = 200 X = 0 Y = 0 screens = display.get_screens() window = pyglet.window.Window(fullscreen=True, screen=screens[1]) # window = pyglet.window.Window(width=W, height=H, resizable=True) # window = pyglet.window.Window(resizable=True, visible=False) win = window win.clear() console = Console(x=X, y=Y,width=W, height=H, window=window) @window.event def on_draw(): glEnable(GL_BLEND) glShadeModel(GL_SMOOTH) glBlendFunc(GL_SRC_ALPHA,GL_ONE) glDisable(GL_DEPTH_TEST) # glClearColor(1,1,1,1) glClearColor(1,0,0,1) window.clear() glLoadIdentity() default_system.draw() # player.get_texture().blit(100, 200,width=400,height=300) console.draw() @window.event def on_resize(width, height): console.resize(width,height) @console.event def on_command(command): global ANS,NBSEC if lokumBorg: ANS, dursec = lokumBorg.reply(command) if ANS: lokumBorg.save_line(ANS.strip()) ANS = list(ANS) ANS.reverse() if dursec!=0: nblettres = len(ANS) NBSEC = float(dursec)/nblettres # set color for the borg console.write ('\n',attributes={'color': (0, 255, 0, 255)}) clock.schedule_interval(callborg, NBSEC) console.prompt(" ") window.push_handlers(console) def callborg(dt): global ANS, NBSEC if ANS: c = ANS.pop() console.write(c) # time.sleep(NBSEC) console._caret.position = len(console._document.text) elif ANS==[]: console.write (' ',attributes={'color': (255, 255, 255, 120)}) console.write ('\n') console.prompt() #console._document.delete_text(0, len(console._document.text)-1) #console._prompt_end = 0 ANS = None clock.unschedule(callborg) else: ANS=None ### ---------- fire flame = StaticEmitter( rate=500, template=Particle( position=(300,25,0), velocity=(0,0,0), color=(1,1,1,1), ), position=Line((win.width/2 - 85, -15, 0), (win.width/2 + 85, -15, 0)), deviation=Particle(position=(10,0,0), velocity=(7,50,0), age=0.75) ) default_system.add_global_controller( Lifetime(6), Gravity((0,20,0)), Movement(), ColorBlender( [(0, (0,0,0.5,0)), (0.5, (0,0,0.5,0.2)), (0.75, (0,0.5,1,0.6)), (1.5, (1,1,0,0.2)), (2.7, (0.9,0.2,0,0.4)), (3.2, (0.6,0.1,0.05,0.2)), (4.0, (0.8,0.8,0.8,0.1)), (6.0, (0.8,0.8,0.8,0)), ] ), ) group = ParticleGroup(controllers=[flame], renderer=PointRenderer(64, SpriteTexturizer(create_point_texture(64, 5)))) #win.set_visible(True) #win.set_visible(True) pyglet.clock.schedule_interval(default_system.update, (1.0/100.0)) pyglet.clock.set_fps_limit(None) if 0: source = pyglet.media.load('/data/video/test.dv') format = source.video_format global player player = pyglet.media.Player() player.queue(source) player.play() default_system.run_ahead(2, 30) ### ------------- fire pyglet.app.run()
glEnable(GL_BLEND) glShadeModel(GL_SMOOTH) glBlendFunc(GL_SRC_ALPHA, GL_ONE) glDisable(GL_DEPTH_TEST) emitter = StaticEmitter( rate=250, template=Particle(size=(6, 6, 0), velocity=(0, -10, 20)), color=[(1, 0, 0), (0, 1, 0), (0, 0, 1), (1, 1, 0), (1, 0.5, 0), (0.5, 0, 1)], rotation=[(0, 0, 0.3), (0, 0, -0.3)], position=AABox((-100, 70, -100), (100, 70, -300)), deviation=Particle(color=(0.1, 0.1, 0.1, 0), rotation=(0, 0, 0.1), velocity=(0, 5, 0)), ) default_system.add_global_controller(Movement(), Collector(Plane((0, 0, 0), (0, 0, -1))), Fader(fade_in_end=15.0)) font = pyglet.font.load(size=72) # Try to force all glyphs into a single texture font.texture_width = font.texture_height = 1024 letter_textures = font.get_glyphs(string.letters) texturizer = SpriteTexturizer( letter_textures[0].texture.id, coords=[tex.tex_coords for tex in letter_textures], aspect_adjust_width=True ) group = ParticleGroup(controllers=[emitter], renderer=BillboardRenderer(texturizer)) win.set_visible(True) pyglet.clock.schedule_interval(default_system.update, (1.0 / 40.0)) pyglet.clock.set_fps_limit(None)
template=Particle(position=(width/2, height-50, 0)), deviation=Particle( velocity=(5, 15, 0), size=(5, 5, 0)), position=[((width*i/4), height, 0) for i in range(5)] ) bubble = pygame.image.load(os.path.join(os.path.dirname(__file__), 'bubble.png')) water = ParticleGroup(controllers=[bubbler], renderer=BlitRenderer(display, bubble, rotate_and_scale=True)) default_system.add_global_controller( Lifetime(7), Gravity((0,-30,0)), Movement(), Growth(4.5), #Fader(fade_in_end=5.0, max_alpha=0.005, fade_out_start=17, fade_out_end=20), ) while 1: for event in pygame.event.get(): if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE): raise SystemExit ms = clock.tick() default_system.update(ms / 1000.0) display.fill((0, 0, 0)) default_system.draw() pygame.display.flip()
yrot = 0.0 @win.event def on_mouse_motion(x, y, dx, dy): global yrot yrot += dx * 0.3 glEnable(GL_BLEND) glShadeModel(GL_SMOOTH) glBlendFunc(GL_SRC_ALPHA, GL_ONE) glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) glDisable(GL_DEPTH_TEST) default_system.add_global_controller(Gravity((0, -15, 0))) MEAN_FIRE_INTERVAL = 3.0 def fire(dt=None): Kaboom() pyglet.clock.schedule_once(fire, expovariate(1.0 / (MEAN_FIRE_INTERVAL - 1)) + 1) fire() win.set_visible(True) pyglet.clock.schedule_interval(default_system.update, (1.0 / 30.0)) pyglet.clock.set_fps_limit(None)
color=(1, 1, 1, 1), ), position=Line((win.width / 2 - 85, -15, 0), (win.width / 2 + 85, -15, 0)), deviation=Particle(position=(10, 0, 0), velocity=(7, 50, 0), age=0.75)) default_system.add_global_controller( Lifetime(6), Gravity((0, 20, 0)), Movement(), ColorBlender([ (0, (0, 0, 0.5, 0)), (0.5, (0, 0, 0.5, 0.2)), (0.75, (0, 0.5, 1, 0.6)), (1.5, (1, 1, 0, 0.2)), (2.7, (0.9, 0.2, 0, 0.4)), (3.2, (0.6, 0.1, 0.05, 0.2)), (4.0, (0.8, 0.8, 0.8, 0.1)), (6.0, (0.8, 0.8, 0.8, 0)), ]), ) group = ParticleGroup(controllers=[flame], renderer=PointRenderer( 64, SpriteTexturizer(create_point_texture(64, 5)))) win.set_visible(True) pyglet.clock.schedule_interval(default_system.update, (1.0 / 30.0)) pyglet.clock.set_fps_limit(None)
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) glDisable(GL_DEPTH_TEST) comet = StaticEmitter(rate=600, template=Particle( size=(2, 2, 0), color=(1, 1, 0), ), deviation=Particle(velocity=(0.7, 0.7, 0.7), up=(0, 0, math.pi), rotation=(0, 0, math.pi), color=(0.5, 0.5, 0.5))) default_system.add_global_controller( Lifetime(3.0), Movement(min_velocity=5), Fader(max_alpha=0.7, fade_out_start=1, fade_out_end=3.0), ) images = [ image.load(os.path.join(os.path.dirname(__file__), 'flare%s.png' % (i + 1))) for i in range(4) ] group = ParticleGroup(controllers=[comet], renderer=BillboardRenderer( SpriteTexturizer.from_images(images))) pyglet.clock.schedule_interval(default_system.update, (1.0 / 30.0)) pyglet.clock.set_fps_limit(None) arc_radius = 150 angle = math.pi * 0.7
rate=10, template=Particle( position=(300,25,0), velocity=(0,35,0), color=(0.8,0.8,0.8,0.005), ), deviation=Particle( position=(10,5,0), velocity=(3,6,0), color=(0.05,0.05,0.05,0.0), ) ) default_system.add_global_controller( Lifetime(20), Gravity((0, -2, 0)), Movement(), Fader(fade_in_end=1.5, max_alpha=0.05, fade_out_start=12, fade_out_end=20), ) group1 = ParticleGroup(controllers=[smoke], renderer=PointRenderer(64, SpriteTexturizer(create_point_texture(64, 1)))) win.set_visible(True) pyglet.clock.schedule_interval(default_system.update, (1.0/30.0)) @win.event def on_draw(): win.clear() glLoadIdentity() default_system.draw() if __name__ == '__main__':
] groups = [ ParticleGroup(controllers=[ StaticEmitter(rate=15000, position=domain, template=Particle( color=(1, 1, 1), size=(.1, .1, 0), )) ], renderer=renderer) for domain in domains ] default_system.add_global_controller( Lifetime(0.5), Fader(max_alpha=0.7, fade_out_start=0.1, fade_out_end=0.5), ) pyglet.clock.schedule_interval(default_system.update, (1.0 / 40.0)) pyglet.clock.set_fps_limit(None) translations = [(-1.1, -1.1), (1.1, -1.1), (-1.1, 1.1), (1.1, 1.1)] rot = 0 @win.event def on_draw(): global rot win.clear() for (xt, yt), group in zip(translations, groups): glLoadIdentity()
deviation=Particle(velocity=(2, 15, 2), color=(10, 10, 0)), position=domain.AABox((width / 2 - spout_radius, 0, -spout_radius), (width / 2 + spout_radius, 0, spout_radius)), color=[(0, 0, 255), (0, 0, 150), (150, 150, 200), (100, 100, 150)], size=[(1, 2, 0), (2, 2, 0), (2, 3, 0)], ) radius = width / 3 sphere = domain.Sphere((width / 2, height, 0), radius) screen_box = domain.AABox((0, 0, -width), (width, height, width)) water = ParticleGroup(controllers=[spray], renderer=FillRenderer(display)) default_system.add_global_controller( Gravity((0, 300, 0)), Movement(), Bounce(sphere, bounce=0.5, friction=0.02), Collector(screen_box, collect_inside=False), ) sphere_rect = (width / 2 - radius, height - radius, radius * 2, radius * 2) while 1: for event in pygame.event.get(): if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE): raise SystemExit ms = clock.tick() default_system.update(ms / 1000.0) display.fill((0, 0, 0)) pygame.draw.ellipse(display, (15, 40, 40), sphere_rect) default_system.draw() pygame.display.flip()
position=(300,25,0), velocity=(0,0,0), color=(1,1,1,1), ), position=Line((win.width/2 - 85, -15, 0), (win.width/2 + 85, -15, 0)), deviation=Particle(position=(10,0,0), velocity=(7,50,0), age=0.75) ) default_system.add_global_controller( Lifetime(6), Gravity((0,20,0)), Movement(), ColorBlender( [(0, (0,0,0.5,0)), (0.5, (0,0,0.5,0.2)), (0.75, (0,0.5,1,0.6)), (1.5, (1,1,0,0.2)), (2.7, (0.9,0.2,0,0.4)), (3.2, (0.6,0.1,0.05,0.2)), (4.0, (0.8,0.8,0.8,0.1)), (6.0, (0.8,0.8,0.8,0)), ] ), ) group = ParticleGroup(controllers=[flame], renderer=PointRenderer(64, SpriteTexturizer(create_point_texture(64, 5)))) win.set_visible(True) pyglet.clock.schedule_interval(default_system.update, (1.0/30.0)) pyglet.clock.set_fps_limit(None)
template=Particle( size=(10,10,0), color=(1,1,0) ), deviation=Particle( position=(0.1,0.1,0), velocity=(10,10,0.7), up=(0,0,math.pi), rotation=(0,0,math.pi), color=(0.5, 0.5, 0.5)) ) #Add group to ball ball.add_particle_group(comet) default_system.add_global_controller( Lifetime(1.75), #Gravity((0,-20,0)), Movement(min_velocity=20), Fader(max_alpha=0.7, fade_out_start=1, fade_out_end=1.75), ) group_tex = [] for i in range(4): group = ParticleGroup(controllers=[comet], renderer=BillboardRenderer()) try: texture = image.load(os.path.join(os.path.dirname(__file__), 'flare1.png')).texture#'flare%s.png' % (i+1))).get_mipmapped_texture() except NotImplementedError: #Problem with mips not being implemented everywhere (cygwin?) texture = image.load(os.path.join(os.path.dirname(__file__), 'flare1.png')).texture group_tex.append((group, texture)) win.resize = resize
for i in range(bumper_count): bumper = Bumper( (win.width / (bumper_count - 1) * i, win.height * 2.0 / 3.0 - (i % 2) * win.height / 3, 0), win.height / 15) bumpers.append(bumper) up_fan = AABox((win.width / 2 - win.width / 12, 0, -1), (win.width / 2 + win.width / 12, win.height * 0.8, 1)) left_fan = AABox((win.width / 2 - win.width / 12, win.height * 0.8, -1), (win.width / 2, win.height, 1)) right_fan = AABox((win.width / 2, win.height * 0.8, -1), (win.width / 2 + win.width / 12, win.height, 1)) default_system.add_global_controller( Gravity((0, -50, 0)), Movement(max_velocity=250), Drag(0.0, 0.0001, (0, 800, 0), domain=up_fan), Drag(0.0, 0.0001, (-200, 400, 0), domain=left_fan), Drag(0.0, 0.0001, (200, 400, 0), domain=right_fan), *[bumper.controller for bumper in bumpers]) # Make the bounce controller for the screen boundary run last # to ensure no particles can "escape" default_system.add_global_controller(Bounce(screen_domain, friction=0.01)) group = ParticleGroup(renderer=PointRenderer(point_size=ball_size)) ball_emitter = StaticEmitter( position=screen_domain, deviation=Particle(velocity=(60, 60, 0), color=(0.3, 0.3, 0.3, 0)), color=[(1, 0, 0, 1), (0, 1, 0, 1), (0, 0, 1, 1), (1, 1, 0, 1), (0, 1, 1, 1), (1, 1, 1, 1)], mass=[1], ) ball_emitter.emit(ball_count, group)
template=Particle( size=(10, 10, 0), color=(1, 1, 0) ), deviation=Particle( position=(0.1, 0.1, 0), velocity=(10, 10, 0.7), up=(0, 0, math.pi), rotation=(0, 0, math.pi), color=(0.5, 0.5, 0.5)) ) # Add group to ball ball.add_particle_group(comet) default_system.add_global_controller( Lifetime(1.75), # Gravity((0,-20,0)), Movement(min_velocity=20), Fader(max_alpha=0.7, fade_out_start=1, fade_out_end=1.75), ) group_tex = [] for i in range(4): group = ParticleGroup( controllers=[comet], renderer=BillboardRenderer()) try: texture = image.load(os.path.join(os.path.dirname(__file__), 'flare1.png')).texture # 'flare%s.png' % (i+1))).get_mipmapped_texture() except NotImplementedError: # Problem with mips not being implemented everywhere (cygwin?) texture = image.load(os.path.join(os.path.dirname(__file__), 'flare1.png')).texture group_tex.append((group, texture))
position=domain.AABox( (width/2 - spout_radius, 0, -spout_radius), (width/2 + spout_radius, 0, spout_radius)), color=[(0,0,255), (0,0,150), (150, 150, 200), (100, 100, 150)], size=[(1,2,0), (2,2,0), (2,3,0)], ) radius = width/3 sphere = domain.Sphere((width/2, height, 0), radius) screen_box = domain.AABox((0,0,-width), (width,height,width)) water = ParticleGroup(controllers=[spray], renderer=FillRenderer(display)) default_system.add_global_controller( Gravity((0,300,0)), Movement(), Bounce(sphere, bounce=0.5, friction=0.02), Collector(screen_box, collect_inside=False), ) sphere_rect = (width/2 - radius, height - radius, radius * 2, radius * 2) while 1: for event in pygame.event.get(): if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE): raise SystemExit ms = clock.tick() default_system.update(ms / 1000.0) display.fill((0, 0, 0)) pygame.draw.ellipse(display, (15,40,40), sphere_rect) default_system.draw() pygame.display.flip()
bumpers = [] for i in range(bumper_count): bumper = Bumper( (win.width/(bumper_count-1) * i, win.height*2.0/3.0 - (i % 2) * win.height/3, 0), win.height / 15) bumpers.append(bumper) up_fan = AABox((win.width/2 - win.width/12, 0, -1), (win.width/2 + win.width/12, win.height * 0.8, 1)) left_fan = AABox((win.width/2 - win.width/12, win.height * 0.8, -1), (win.width/2, win.height, 1)) right_fan = AABox((win.width/2, win.height * 0.8, -1), (win.width/2 + win.width/12, win.height, 1)) default_system.add_global_controller( Gravity((0,-50,0)), Movement(max_velocity=250), Drag(0.0, 0.0001, (0, 800, 0), domain=up_fan), Drag(0.0, 0.0001, (-200, 400, 0), domain=left_fan), Drag(0.0, 0.0001, (200, 400, 0), domain=right_fan), *[bumper.controller for bumper in bumpers] ) # Make the bounce controller for the screen boundary run last # to ensure no particles can "escape" default_system.add_global_controller( Bounce(screen_domain, friction=0.01) ) group = ParticleGroup(renderer=PointRenderer(point_size=ball_size)) ball_emitter = StaticEmitter( position=screen_domain, deviation=Particle(velocity=(60,60,0), color=(0.3,0.3,0.3,0)), color=[(1,0,0,1), (0,1,0,1), (0,0,1,1), (1,1,0,1), (0,1,1,1), (1,1,1,1)], mass=[1],
size=(6,6,0), velocity=(0,-10,20), ), color=[(1,0,0), (0,1,0), (0,0,1), (1,1,0), (1,0.5,0), (0.5,0,1)], rotation=[(0,0,0.3), (0,0,-0.3)], position=AABox((-100, 70, -100), (100, 70, -300)), deviation=Particle( color=(0.1, 0.1, 0.1, 0), rotation=(0,0,0.1), velocity=(0,5,0), ) ) default_system.add_global_controller( Movement(), Collector(Plane((0, 0, 0), (0, 0, -1))), Fader(fade_in_end=15.0), ) font = pyglet.font.load(size=72) # Try to force all glyphs into a single texture font.texture_width = font.texture_height = 1024 letter_textures = font.get_glyphs(string.ascii_lowercase) texturizer = SpriteTexturizer( letter_textures[0].texture.id, coords=[tex.tex_coords for tex in letter_textures], aspect_adjust_width=True) group = ParticleGroup(controllers=[emitter], renderer=BillboardRenderer(texturizer))
size=(5, 5, 0)), position=[((width * i / 4), height, 0) for i in range(5)]) bubble = pygame.image.load( os.path.join(os.path.dirname(__file__), 'bubble.png')) water = ParticleGroup(controllers=[bubbler], renderer=BlitRenderer(display, bubble, rotate_and_scale=True)) default_system.add_global_controller( Lifetime(7), Gravity((0, -30, 0)), Movement(), Growth(4.5), #Fader(fade_in_end=5.0, max_alpha=0.005, fade_out_start=17, fade_out_end=20), ) while 1: for event in pygame.event.get(): if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE): raise SystemExit ms = clock.tick() default_system.update(ms / 1000.0) display.fill((0, 0, 0)) default_system.draw() pygame.display.flip()
comet = StaticEmitter( rate=600, template=Particle( size=(2,2,0), color=(1,1,0), ), deviation=Particle( velocity=(0.7,0.7,0.7), up=(0,0,math.pi), rotation=(0,0,math.pi), color=(0.5, 0.5, 0.5)) ) default_system.add_global_controller( Lifetime(3.0), Movement(min_velocity=5), Fader(max_alpha=0.7, fade_out_start=1, fade_out_end=3.0), ) images = [image.load(os.path.join(os.path.dirname(__file__), 'flare%s.png' % (i+1))) for i in range(4)] group = ParticleGroup(controllers=[comet], renderer=BillboardRenderer(SpriteTexturizer.from_images(images))) pyglet.clock.schedule_interval(default_system.update, (1.0/30.0)) pyglet.clock.set_fps_limit(None) arc_radius = 150 angle = math.pi * 0.7 speed = 1.0 def move_comet(td):
ParticleGroup( controllers=[ StaticEmitter( rate=15000, position=domain, template=Particle( color=(1,1,1), size=(.1,.1,0), ) ) ], renderer=renderer) for domain in domains] default_system.add_global_controller( Lifetime(0.5), Fader(max_alpha=0.7,fade_out_start=0.1, fade_out_end=0.5), ) pyglet.clock.schedule_interval(default_system.update, (1.0/40.0)) pyglet.clock.set_fps_limit(None) translations = [(-1.1,-1.1), (1.1,-1.1), (-1.1,1.1), (1.1,1.1)] rot = 0 @win.event def on_draw(): global rot win.clear() for (xt, yt), group in zip(translations, groups): glLoadIdentity() glTranslatef(xt, yt, -8)
glDisable(GL_DEPTH_TEST) disc = domain.Disc((0, 0, -50), (0, 0, 1), 1.5, 1.5) viewer_plane = domain.Plane((0, 0, 0), (0, 0, -1)) jet = StaticEmitter(rate=2000, position=disc, template=Particle(color=(1, 1, 0), ), deviation=Particle(velocity=(0, 0, 15), up=(0, 0, math.pi), color=(0.1, 0.1, 0.1))) default_system.add_global_controller( Movement(max_velocity=10), Collector(viewer_plane), Gravity((0, 0, 15)), Growth(0.17), Fader(fade_in_end=0, max_alpha=0.3, fade_out_start=0, fade_out_end=8.0), ) texture = image.load(os.path.join(os.path.dirname(__file__), 'Particle.bmp')).get_texture() group = ParticleGroup(controllers=[jet], renderer=BillboardRenderer(SpriteTexturizer(texture.id))) default_system.run_ahead(5, 40) pyglet.clock.schedule_interval(default_system.update, (1.0 / 30.0)) pyglet.clock.set_fps_limit(None) time = 0
yrot = 0.0 @win.event def on_mouse_motion(x, y, dx, dy): global yrot yrot += dx * 0.3 glEnable(GL_BLEND) glShadeModel(GL_SMOOTH) glBlendFunc(GL_SRC_ALPHA,GL_ONE) glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST); glDisable(GL_DEPTH_TEST) default_system.add_global_controller( Gravity((0,-15,0)) ) MEAN_FIRE_INTERVAL = 3.0 def fire(dt=None): Kaboom() pyglet.clock.schedule_once(fire, expovariate(1.0 / (MEAN_FIRE_INTERVAL - 1)) + 1) fire() win.set_visible(True) pyglet.clock.schedule_interval(default_system.update, (1.0/30.0)) pyglet.clock.set_fps_limit(None) @win.event def on_draw():