Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # absorb_effect.py aka particle_charge
- import appuifw,graphics,e32,sysinfo,random
- def quit():
- global run
- run=0
- def draw(rect):
- try: canvas.blit(img)
- except: pass
- img=None
- appuifw.app.screen='large'
- appuifw.app.orientation='portrait'
- appuifw.app.directional_pad=False
- xy=sysinfo.display_pixels()
- img=graphics.Image.new(xy)
- appuifw.app.body=canvas=appuifw.Canvas(redraw_callback=draw)
- appuifw.app.exit_key_handler=quit
- xy=xy[0],xy[1]-90
- x,y=xy[0]/2,xy[1]/2
- sprites,timer,reset,obj=100,10,5,[]
- target=[x,y]
- flare=20.0/y
- def moving(pos,target,spd):
- mov=0
- if pos+spd <= target:mov=spd
- if pos-spd >= target:mov=-spd
- return mov
- def cycle():
- return ([random.randrange(xy[0]),random.randrange(xy[1]),1])
- run=1
- while run:
- if len(obj)<sprites:obj.append(cycle())
- img.clear(0)
- for i in range(len(obj)):
- if obj[i][0] == x or obj[i][1] == y or obj[i][2] > 8+random.randrange(12):
- obj[i]=cycle()
- obj[i][0]+=moving(obj[i][0],target[0],1)
- obj[i][1]+=moving(obj[i][1],target[1],1)
- obj[i][2]+=flare
- img.point((obj[i][0],obj[i][1]),0xdadada,width=int(obj[i][2]))
- draw(())
- e32.ao_sleep(0.02)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement