from random import randint as rd from kandinsky import fill_rect as fr from kandinsky import * from ion import keydown as kd, KEY_LEFT as kl, KEY_RIGHT as kr,KEY_OK as ko from time import sleep as s pl=[(145,198,26,4,color(74,66,0)),(147,194,22,4,color(74,66,0)), (149,188,18,6,color(74,66,0)),(151,186,14,2,color(74,66,0))] nb_pl=0 def player(): nb_pl=0 for nb_pl in range(len(pl)): fr(*pl[nb_pl]) o=7 colorc="black" bx1=0 by1=-10 bo1=0 tir=0 score=0 def canon(): if o==1: fr(135,196,12,2,colorc) if o==2: fr(135,192,8,2,colorc) fr(143,194,4,2,colorc) if o==3: fr(135,188,4,4,colorc) fr(139,190,6,4,colorc) fr(145,192,4,4,colorc) if o==4: fr(137,184,4,4,colorc) fr(141,186,4,4,colorc) fr(145,188,4,4,colorc) if o==5: fr(141,178,2,4,colorc) fr(143,180,4,4,colorc) fr(147,182,2,4,colorc) fr(149,184,2,2,colorc) if o==6: fr(149,174,2,4,colorc) fr(151,176,2,6,colorc) fr(153,180,2,6,colorc) fr(155,184,2,2,colorc) if o==7: fr(157,173,2,13,colorc) if o==8: fr(165,174,2,4,colorc) fr(163,176,2,6,colorc) fr(161,180,2,6,colorc) fr(159,184,2,4,colorc) if o==9: fr(169,178,2,4,colorc) fr(168,180,2,4,colorc) fr(166,182,2,4,colorc) fr(164,184,2,4,colorc) if o==10: fr(171,182,4,4,colorc) fr(167,184,4,4,colorc) fr(163,186,4,2,colorc) if o==11: fr(175,188,6,4,colorc) fr(167,190,8,4,colorc) if o==12: fr(169,194,14,2,colorc) xp=100 yp=-20 nb_p=0 colorp="black" def para(xp,yp): fr(xp+5,yp,6,1,colorp) fr(xp+4,yp+1,9,1,colorp) fr(xp+3,yp+2,11,1,colorp) fr(xp+3,yp+3,13,1,colorp) fr(xp+1,yp+4,15,1,colorp) fr(xp,yp+5,16,1,colorp) fr(xp+3,yp+6,1,6,colorp) fr(xp+12,yp+6,1,6,colorp) fr(xp+6,yp+10,3,6,colorp) fr(xp+3,yp+12,10,1,colorp) fr(xp+5,yp+16,1,1,colorp) fr(xp+4,yp+17,1,1,colorp) fr(xp+9,yp+16,1,1,colorp) fr(xp+10,yp+17,1,1,colorp) # fr(xp+4,yp+11,2,1,color(105,200,209)) fr(xp+6,yp+9,3,1,color(105,200,209)) fr(xp+9,yp+11,3,1,color(105,200,209)) fr(xp+5,yp-1,7,1,color(105,200,209)) fr(xp+4,yp,1,1,color(105,200,209)) fr(xp+3,yp+1,1,1,color(105,200,209)) fr(xp+2,yp+2,1,1,color(105,200,209)) fr(xp+1,yp+3,1,1,color(105,200,209)) fr(xp,yp+4,1,1,color(105,200,209)) fr(xp+11,yp,2,1,color(105,200,209)) fr(xp+13,yp+1,1,1,color(105,200,209)) fr(xp+14,yp+2,1,1,color(105,200,209)) fr(xp+15,yp+3,1,1,color(105,200,209)) fr(xp+5,yp+15,1,1,color(105,200,209)) fr(xp+4,yp+16,1,1,color(105,200,209)) fr(xp+9,yp+15,1,1,color(105,200,209)) fr(xp+10,yp+16,1,1,color(105,200,209)) xp1=100 yp1=-20 xp2=50 yp2=-20 xp3=100 yp3=-20 fall=-1 fall2=-1 fall3=-1 xp4=100 yp4=-20 fall4=-1 xp5=100 yp5=-20 fall5=-1 xp6=100 yp6=-20 fall6=-1 xh=50 yh=10 flap=1 xh1=50 yh1=10 flap2=1 xh2=300 yh2=10 move=5 move2=1 hc=1 def helicoptere(xh,yh): if flap==1: fr(xh-5,yh+2,40,2,"black") else: fr(xh-5,yh+2,40,2,color(105,200,209)) # fr(xh+12,yh+4,4,2,"black") fr(xh+12,yh+6,12,2,"black") fr(xh+8,yh+8,20,4,"black") fr(xh+4,yh+10,6,4,"black") fr(xh+2,yh+12,4,2,"black") fr(xh,yh+14,8,2,"black") fr(xh+2,yh+16,24,2,"black") fr(xh+6,yh+18,16,2,"black") fr(xh+10,yh+20,2,2,"black") fr(xh+18,yh+20,2,2,"black") fr(xh+2,yh+22,28,2,"black") fr(xh+24,yh+11,24,3,"black") fr(xh+46,yh+6,2,8,"black") fr(xh+24,yh+14,4,2,"black") fr(xh+14,yh+10,4,6,"black") # fr(xh+36,yh+2,2,2,color(105,200,209)) fr(xh+16,yh+4,2,2,color(105,200,209)) fr(xh+24,yh+6,2,2,color(105,200,209)) fr(xh+28,yh+8,2,2,color(105,200,209)) fr(xh+48,yh+6,2,8,color(105,200,209)) fr(xh+28,yh+14,2,2,color(105,200,209)) fr(xh+22,yh+18,2,2,color(105,200,209)) fr(xh+20,yh+20,2,2,color(105,200,209)) fr(xh+12,yh+20,2,2,color(105,200,209)) fr(xh+8,yh+12,2,2,color(105,200,209)) fr(xh+6,yh+14,2,2,color(105,200,209)) fr(xh+16,yh+12,2,4,color(105,200,209)) fr(xh+26,yh+16,2,2,color(105,200,209)) fr(xh+30,yh+22,2,2,color(105,200,209)) fr(0,0,350,250,color(105,200,209)) fr(0,202,350,1,color(0,0,0)) fr(0,203,350,50,color(46,24,-68)) go=1 niveau=0 xa=0 ya=0 def arbre(xa,ya): fr(xa,ya-22,4,22,color(110,42,8)) fr(xa-8,ya-34,20,12,color(0,100,0)) fr(xa-12,ya-26,4,4,color(0,100,0)) fr(xa-4,ya-42,8,8,color(0,100,0)) fr(xa+4,ya-22,4,8,color(0,100,0)) def arbre1(xa,ya): fr(xa,ya-27,4,27,color(110,42,8)) fr(xa-8,ya-39,20,12,color(0,50,0)) fr(xa-4,ya-47,8,8,color(0,50,0)) fr(xa+4,ya-27,4,8,color(0,50,0)) def arbre3(xa,ya): fr(xa,ya-17,4,17,color(110,42,8)) fr(xa-8,ya-29,20,12,color(0,50,20)) fr(xa-4,ya-37,8,8,color(0,50,20)) fr(xa+4,ya-17,4,8,color(0,50,20)) while go==1: arbre(200,202) arbre1(15,202) arbre(59,202) arbre(80,202) arbre1(100,202) arbre1(230,202) arbre(250,202) arbre3(35,202) arbre3(275,202) if xh1>-48 and move<0: xh1=xh1-1 move=2 if flap==1: flap=0 else: flap=1 elif xh1<=-48: xh1=290 yh1=rd(10,30) helicoptere(xh1,yh1) if xh2>-48 and move2<0: xh2=xh2-1 move2=2 if flap2==1: flap2=0 else: flap2=1 elif xh2<=-48: xh2=290 yh2=rd(10,30) helicoptere(xh2,yh2) if bx1>=xp1-3 and bx1<xp1+16 and by1>yp1-3 and by1<yp1+16: fr(xp1,yp1,16,18,color(105,200,209)) fr(bx1,by1,3,3,color(105,200,209)) yp1=-20 fall=10 bx1=0 by1=-10 bo1=0 score=score+3 if xp1<0: xp1=xp1+1 if yp1<0: hc=rd(1,2) if hc==1: yp1=yh1+24 xp1=xh1 else: yp1=yh2+24 xp1=xh2 elif yp1<184 and fall<0: yp1=yp1+1 para(xp1,yp1) fall=10 elif yp1==184: yp1=-20 go=0 if xp2<0: xp2=xp2+1 if yp2<0 and niveau>1000: hc=rd(1,2) if hc==1: yp2=yh1+24 xp2=xh1 else: yp2=yh2+24 xp2=xh2 elif yp2<184 and fall2<0 and niveau>1000: yp2=yp2+1 para(xp2,yp2) fall2=13 elif yp2==184 and niveau>1000: go=0 if bx1>=xp2-3 and bx1<xp2+16 and by1>yp2-3 and by1<yp2+16: fr(xp2,yp2,16,18,color(105,200,209)) fr(bx1,by1,3,3,color(105,200,209)) yp2=-20 fall2=10 bx1=0 by1=-10 bo1=0 score=score+3 if xp3<0: xp3=xp3+1 if yp3<0 and niveau>2000: hc=rd(1,2) if hc==1: yp3=yh1+24 xp3=xh1 else: yp3=yh2+24 xp3=xh2 elif yp3<184 and fall3<0 and niveau>2000: yp3=yp3+1 para(xp3,yp3) fall3=20 elif yp3==184 and niveau>2000: yp3=-20 go=0 if bx1>=xp3-3 and bx1<xp3+16 and by1>yp3-3 and by1<yp3+16: fr(xp3,yp3,16,18,color(105,200,209)) fr(bx1,by1,3,3,color(105,200,209)) yp3=-20 fall3=10 bx1=0 by1=-10 bo1=0 score=score+3 if xp4<0: xp4=xp4+1 if yp4<0 and niveau>3000: hc=rd(1,2) if hc==1: yp4=yh1+24 xp4=xh1 else: yp4=yh2+24 xp4=xh2 elif yp4<184 and fall4<0 and niveau>3000: yp4=yp4+1 para(xp4,yp4) fall4=6 elif yp4==184 and niveau>3000: yp4=-20 go=0 if bx1>=xp4-3 and bx1<xp4+16 and by1>yp4-3 and by1<yp4+16: fr(xp4,yp4,16,18,color(105,200,209)) fr(bx1,by1,3,3,color(105,200,209)) yp4=-20 fall4=10 bx1=0 by1=-10 bo1=0 score=score+3 if xp5<0: xp5=xp5+1 if yp5<0 and niveau>4000: hc=rd(1,2) if hc==1: yp5=yh1+24 xp5=xh1 else: yp5=yh2+24 xp5=xh2 elif yp5<184 and fall5<0 and niveau>4000: yp5=yp5+1 para(xp5,yp5) fall5=6 elif yp5==184 and niveau>4000: yp5=-20 go=0 if bx1>=xp5-3 and bx1<xp5+16 and by1>yp5-3 and by1<yp5+16: fr(xp5,yp5,16,18,color(105,200,209)) fr(bx1,by1,3,3,color(105,200,209)) yp5=-20 fall5=10 bx1=0 by1=-10 bo1=0 score=score+3 if xp6<0: xp6=xp6+1 if yp6<0 and niveau>5000: hc=rd(1,2) if hc==1: yp6=yh1+24 xp6=xh1 else: yp6=yh2+24 xp6=xh2 elif yp6<184 and fall6<0 and niveau>5000: yp6=yp6+1 para(xp6,yp6) fall6=6 elif yp6==184 and niveau>5000: yp6=-20 go=0 if bx1>=xp6-3 and bx1<xp6+16 and by1>yp6-3 and by1<yp6+16: fr(xp6,yp6,16,18,color(105,200,209)) fr(bx1,by1,3,3,color(105,200,209)) yp6=-20 fall6=10 bx1=0 by1=-10 bo1=0 score=score+3 if kd(kl) and o>1 and tir<0: colorc=(105,200,209) canon() o=o-1 tir=10 if kd(kr) and o<12 and tir<0: colorc=(105,200,209) canon() o=o+1 tir=10 if kd(ko): if bo1==0: bo1=o if score>0: score=score-1 if bo1==1: if bx1==0: bx1=135 by1=196 else: bx1=bx1-2 fr(bx1+2,by1,3,3,color(105,200,209)) if bo1==2: if bx1==0: bx1=135 by1=192 else: bx1=bx1-4 by1=by1-1 fr(bx1+4,by1+1,3,3,color(105,200,209)) if bo1==3: if bx1==0: bx1=135 by1=188 else: bx1=bx1-2 by1=by1-1 fr(bx1+2,by1+1,3,3,color(105,200,209)) if bo1==4: if bx1==0: bx1=137 by1=182 else: bx1=bx1-2 by1=by1-1 fr(bx1+2,by1+1,3,3,color(105,200,209)) if bo1==5: if bx1==0: bx1=139 by1=176 else: bx1=bx1-2 by1=by1-2 fr(bx1+2,by1+2,3,3,color(105,200,209)) if bo1==6: if bx1==0: bx1=149 by1=170 else: bx1=bx1-1 by1=by1-2 fr(bx1+1,by1+2,3,3,color(105,200,209)) if bo1==7: if bx1==0: bx1=157 by1=155 else: by1=by1-2 fr(bx1,by1+2,3,3,color(105,200,209)) if bo1==8: if bx1==0: bx1=165 by1=170 else: bx1=bx1+1 by1=by1-2 fr(bx1-1,by1+2,3,3,color(105,200,209)) if bo1==9: if bx1==0: bx1=173 by1=176 else: bx1=bx1+2 by1=by1-2 fr(bx1-2,by1+2,3,3,color(105,200,209)) if bo1==10: if bx1==0: bx1=177 by1=182 else: bx1=bx1+2 by1=by1-1 fr(bx1-2,by1+1,3,3,color(105,200,209)) if bo1==11: if bx1==0: bx1=181 by1=188 else: bx1=bx1+4 by1=by1-1 fr(bx1-4,by1+1,3,3,color(105,200,209)) if bo1==12: if bx1==0: bx1=181 by1=194 else: bx1=bx1+2 by1=by1 fr(bx1-2,by1,3,3,color(105,200,209)) if bx1<=0 or by1<-5 or bx1>320: bx1=0 by1=-10 bo1=0 fr(bx1,by1,3,3,colorc) colorc="black" player() canon() tir=tir-1 fall=fall-1 fall2=fall2-1 fall3=fall3-1 fall4=fall4-1 fall5=fall5-1 fall6=fall6-1 draw_string(str(score)+" ",130,3,"black",color(105,200,209)) niveau=niveau+1 move=move-1 move2=move2-1 draw_string("Un parachutiste a atteri!",30,100,"black",color(105,200,209)) s(3) xf=330 cb=209 while not xf<-0: fr(xf,0,5,250,color(105,200,int(cb))) fr(xf-2,0,2,250,"black") xf=xf-5 cb=cb-1 s(0.01) flap=1 helicoptere(10,10) helicoptere(40,170) helicoptere(150,190) helicoptere(100,10) helicoptere(270,10) para(50,50) para(270,80) fr(74,94,162,52,"black") fr(75,95,160,50,"white") draw_string("Jeu par Aubin",80,100,"black","white") draw_string("Ton score: "+str(score),88,120,"black","white")