from math import * from time import * from ion import keydown as kd,KEY_OK as ko,KEY_UP as ku from kandinsky import fill_rect as fr from kandinsky import * from random import * x=50 y=100 y1=1 y2=0 xp=0 yp=0 xp1=250 yp1=0 xp2=375 yp2=0 xp3=500 yp3=0 wing_power=0 flap=0 intervalle=10 score=0 go=1 play=1 fr(0,0,350,350,color(173,216,231)) def bird(x,y): if y2-y1>0: fr(x,y-10,32,10,color(173,216,231)) fr(x,y,8,4,color(173,216,231)) fr(x,y+4,6,2,color(173,216,231)) fr(x,y+6,2,2,color(173,216,231)) fr(x+8,y,4,2,color(173,216,231)) fr(x+30,y+0,2,14,color(173,216,231)) fr(x+26,y,4,4,color(173,216,231)) fr(x+24,y,2,2,color(173,216,231)) fr(x+28,y+4,2,2,color(173,216,231)) else : fr(x,y+24,32,10,color(173,216,231)) fr(x,y+14,2,10,color(173,216,231)) fr(x+2,y+16,2,8,color(173,216,231)) fr(x+4,y+20,2,4,color(173,216,231)) fr(x+6,y+22,4,2,color(173,216,231)) fr(x+20,y+22,12,2,color(173,216,231)) fr(x+30,y+16,2,8,color(173,216,231)) fr(x+28,y+20,2,2,color(173,216,231)) fr(x+12,y,12,2,"black") fr(x+8,y+2,4,2,"black") fr(x+4,y+4,2,2,"black") fr(x+2,y+6,8,2,"black") fr(x,y+8,2,6,"black") fr(x+2,y+14,2,2,"black") fr(x+4,y+16,6,2,"black") fr(x+4,y+18,2,2,"black") fr(x+6,y+20,4,2,"black") fr(x+10,y+22,10,2,"black") fr(x+20,y+20,8,2,"black") fr(x+28,y+16,2,4,"black") fr(x+20,y+16,8,2,"black") fr(x+18,y+18,2,2,"black") fr(x+16,y+16,2,2,"black") fr(x+18,y+14,2,2,"black") fr(x+20,y+12,10,2,"black") fr(x+30,y+14,2,2,"black") fr(x+28,y+6,2,6,"black") fr(x+24,y+6,2,4,"black") fr(x+26,y+4,2,2,"black") fr(x+24,y+2,2,2,"black") fr(x+18,y+2,2,2,"black") fr(x+16,y+4,2,6,"black") fr(x+18,y+10,2,2,"black") fr(x+10,y+8,2,2,"black") fr(x+12,y+10,2,4,"black") fr(x+10,y+14,2,2,"black") fr(x+2,y+12,2,2,"yellow") fr(x+4,y+14,6,2,"yellow") fr(x+10,y+12,2,2,"yellow") fr(x+12,y+4,4,6,"yellow") fr(x+14,y+10,4,6,"yellow") fr(x+12,y+14,2,2,"yellow") fr(x+18,y+12,2,2,"yellow") fr(x+10,y+16,6,6,"orange") fr(x+6,y+18,12,2,"orange") fr(x+16,y+20,4,2,"orange") fr(x+20,y+18,8,2,"red") fr(x+18,y+16,2,2,"red") fr(x+20,y+14,10,2,"red") fr(x+2,y+8,8,4,"white") fr(x+4,y+12,6,2,"white") fr(x+10,y+10,2,2,"white") fr(x+12,y+2,6,2,"white") fr(x+8,y+4,4,2,"white") fr(x+20,y+2,4,10,"white") fr(x+18,y+4,2,6,"white") fr(x+24,y+4,2,2,"white") fr(x+26,y+6,2,6,"white") fr(x+24,y+10,4,2,"white") def pipes(xp,yp): #1 fr(xp,yp+150,38,2,"black") fr(xp,yp+150,2,8,"black") fr(xp+2,yp+158,2,6,"black") fr(xp+4,yp+164,2,150,"black") fr(xp+36,yp+150,2,8,"black") fr(xp+34,yp+158,2,4,"black") fr(xp+32,yp+162,2,150,"black") fr(xp+6,yp+164,26,2,"black") fr(xp+2,yp+152,2,6,color(144,238,144)) fr(xp+4,yp+158,2,6,color(144,238,144)) fr(xp+6,yp+166,2,150,color(144,238,144)) fr(xp+34,yp+152,2,6,color(144,238,144)) fr(xp+32,yp+158,2,4,color(144,238,144)) fr(xp+30,yp+162,2,1,color(144,238,144)) fr(xp+30,yp+166,2,150,color(144,238,144)) fr(xp+4,yp+152,30,6,color(0,100,0)) fr(xp+6,yp+158,26,6,color(0,100,0)) fr(xp+8,yp+166,22,150,color(0,100,0)) fr(xp+38,yp+150,2,150,color(173,216,230)) fr(xp+36,yp+158,2,150,color(173,216,230)) fr(xp+34,yp+162,2,150,color(173,216,230)) #2 fr(xp,yp+68,38,2,"black") fr(xp,yp+62,2,8,"black") fr(xp+2,yp+56,2,6,"black") fr(xp+4,yp-80,2,136,"black") fr(xp+36,yp+62,2,6,"black") fr(xp+34,yp+56,2,6,"black") fr(xp+32,yp-80,2,136,"black") fr(xp+4,yp+54,30,2,"black") fr(xp+2,yp+62,2,6,color(144,238,144)) fr(xp+4,yp+56,2,6,color(144,238,144)) fr(xp+6,yp-80,2,134,color(144,238,144)) fr(xp+34,yp+62,2,6,color(144,238,144)) fr(xp+32,yp+56,2,6,color(144,238,144)) fr(xp+30,yp-80,2,134,color(144,238,144)) fr(xp+2,yp+62,2,6,color(144,238,144)) fr(xp+4,yp+56,2,6,color(144,238,144)) fr(xp+6,yp+56,26,6,color(0,100,0)) fr(xp+4,yp+62,30,6,color(0,100,0)) fr(xp+8,yp-80,22,134,color(0,100,0)) fr(xp+38,yp-80,2,150,color(173,216,230)) fr(xp+36,yp-80,2,142,color(173,216,230)) fr(xp+34,yp-80,2,136,color(173,216,230)) fr(xp+4,yp+152,30,6,color(0,100,0)) fr(xp+6,yp+158,26,6,color(0,100,0)) fr(xp+8,yp+166,22,150,color(0,100,0)) fr(xp+38,yp+150,2,150,color(173,216,230)) fr(xp+36,yp+158,2,150,color(173,216,230)) while play==1: while go==1: xp=xp1 yp=yp1 pipes(xp,yp) xp1=xp1-2 if xp1<=-40: xp1=320 yp1=randint(-50,80) xp=xp2 yp=yp2 pipes(xp,yp) xp2=xp2-2 if xp2<=-40: xp2=320 yp2=randint(-50,80) xp=xp3 yp=yp3 pipes(xp,yp) xp3=xp3-2 if xp3<=-40: xp3=320 yp3=randint(-50,80) bird(x,y) y1=y y=y+wing_power intervalle=intervalle-1 if y>200: flap=0 wing_power=-3 if y<0: flap=0 wing_power=3 if kd(ko) or kd(ku): if not y>200 and not y<0: flap=10 wing_power=-2 if intervalle==0 and flap==0: wing_power=wing_power+1 intervalle=5 if intervalle==0 and flap>0: wing_power=wing_power+1 intervalle=5 if x+26>xp1 and x<xp1+38 and y>yp1+138: go=0 if x+26>xp1 and x<xp1+38 and y<yp1+68: go=0 if x+26>xp2 and x<xp2+38 and y>yp2+138: go=0 if x+26>xp2 and x<xp2+38 and y<yp2+68: go=0 if x+26>xp3 and x<xp3+38 and y>yp3+138: go=0 if x+26>xp3 and x<xp3+38 and y<yp3+68: go=0 y2=y if x>xp1-1 and x<xp1+1: score=score+1 if x>xp2-1 and x<xp2+1: score=score+1 if x>xp3-1 and x<xp3+1: score=score+1 draw_string(str(score),150,5,"black",color(173,216,230)) sleep(0.001) intervalle=5 flap=0 wing_power=3 while not y>280: pipes(xp1,yp1) pipes(xp2,yp2) pipes(xp3,yp3) bird(x,y) draw_string(str(score),150,5,"black",color(173,216,230)) y1=y intervalle=intervalle-1 y=y+wing_power if intervalle==0 and flap==0: wing_power=wing_power+1 intervalle=5 y2=y sleep(0.005) x=320 y=0 for i in range(330): fr(x,y,5,250,"black") fr(x+5,y,5,250,color(173,216,230)) x=x-1 sleep(0.001) draw_string("BRAVO",130,95,"black",color(173,216,230)) draw_string("jeu par Aubin",92,110,"black",color(173,216,230)) draw_string("Ton score: "+str(score),100,128,"black",color(173,216,230)) draw_string("[OK] pour rejouer",80,145,"black",color(173,216,230)) xp=10 yp=50 pipes(xp,yp) xp=250 yp=50 pipes(xp,yp) xp=135 yp=20 pipes(xp,yp) while go==0: if kd(ko) and go==0: fr(0,0,350,250,color(173,216,230)) x=50 y=100 y1=1 y2=0 xp=0 yp=0 xp1=200 yp1=0 xp2=325 yp2=0 xp3=450 yp3=0 wing_power=0 flap=0 intervalle=10 score=0 go=1