from math import * from kandinsky import * from random import * from ion import * def point(): #Initialise les carreÌs return[randrange(-160,160),randrange(-120,120),randrange(1,10)] nb=60 st=[0]*nb pr=[0]*nb def init(): for i in range(320*240): set_pixel(i%320,i//320,color(0,0,0)) for i in range(nb): st[i]=point() def go(nb): #DeÌmarrer le programme init() while True: for i in range(nb): st[i][2]-=0.2 if st[i][2]<=0: st[i]=point() z=st[i][2] px=min(320,max(-1,st[i][0]/z+160)) py=min(240,max(-1,st[i][1]/z+120)) if pr[i]!=0: set_pixel(pr[i][0],pr[i][1],color(0,0,9)) pr[i]=[int(px),int(py)] c=int((1-z/10)*255) set_pixel(pr[i][0],pr[i][1],color(255-c,c,3*c)) if keydown(KEY_SHIFT): break if keydown(KEY_ALPHA): for i in range(320*240): set_pixel(i%320,i//320,color(250,250,250)) if keydown(KEY_SHIFT): break for i in range(nb): st[i]=point() if keydown(KEY_SHIFT): break while True: for i in range(nb): st[i][2]-=0.2 if st[i][2]<=0: st[i]=point() z=st[i][2] px=min(320,max(-1,st[i][0]/z+160)) py=min(240,max(-1,st[i][1]/z+120)) if pr[i]!=0: set_pixel(pr[i][0],pr[i][1],color(0,0,9)) pr[i]=[int(px),int(py)] c=int((1-z/10)*255) set_pixel(pr[i][0],pr[i][1],color(255-c,c,3*c)) if keydown(KEY_SHIFT): break