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 * from ion import * 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,couleur) fr(xp+36,yp+158,2,150,couleur) fr(xp+34,yp+162,2,150,couleur) #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,couleur) fr(xp+36,yp-80,2,142,couleur) fr(xp+34,yp-80,2,136,couleur) 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,couleur) fr(xp+36,yp+158,2,150,couleur) couleur_l=[color(0,100,100),color(173,216,230),"""grey""","""pink""","""brown""", """black""",color(0,0,100),color(0,100,200),"""green"""] menu=1 selection=2 color_nb=1 couleur=color(173,216,230) fr(0,0,350,300,color(173,216,230)) couleur=(173,216,230) xp=20 yp=50 pipes(xp,yp) xp=260 yp=50 pipes(xp,yp) draw_string("Jeu par Aubin",80,55,"black",color(173,216,230)) draw_string("[shift]/[ON/OFF]!",65,150,"black",color(173,216,230)) fr(102,86,92,47,"black") fr(103,87,90,45,"white") draw_string("<- ->",110,90,"black","white") fr(135,91,15,15,couleur_l[color_nb]) draw_string("jouer",118,110,"red","white") while menu==1: couleur=couleur_l[color_nb] if kd(KEY_LEFT) and color_nb>0 and selection==1: color_nb=color_nb-1 fr(135,91,15,15,couleur_l[color_nb]) couleur=couleur_l[color_nb] sleep(0.3) print(couleur) if kd(KEY_RIGHT) and color_nb<len(couleur_l)-1 and selection==1: color_nb=color_nb+1 fr(135,91,15,15,couleur_l[color_nb]) sleep(0.3) couleur=couleur_l[color_nb] print(couleur) if kd(ku) and selection==2: selection=1 draw_string("<- ->",110,90,"red","white") fr(135,91,15,15,couleur_l[color_nb]) draw_string("jouer",118,110,"black","white") if kd(KEY_DOWN) and selection==1: selection=2 draw_string("<- ->",110,90,"black","white") fr(135,91,15,15,couleur_l[color_nb]) draw_string("jouer",118,110,"red","white") if kd(ko) and selection==2: menu=0 if couleur=="black" or couleur==color(0,0,100) or couleur==color(0,100,200): couleur_e="""white""" else: couleur_e="""black""" 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 pause=0 fr(0,0,350,350,couleur) def bird(x,y): if y2-y1>0: fr(x,y-10,32,10,couleur) fr(x,y,8,4,couleur) fr(x,y+4,6,2,couleur) fr(x,y+6,2,2,couleur) fr(x+8,y,4,2,couleur) fr(x+30,y+0,2,14,couleur) fr(x+26,y,4,4,couleur) fr(x+24,y,2,2,couleur) fr(x+28,y+4,2,2,couleur) else : fr(x,y+24,32,4,couleur) fr(x,y+14,2,4,couleur) fr(x+2,y+16,2,4,couleur) fr(x+4,y+20,2,4,couleur) fr(x+6,y+22,4,2,couleur) fr(x+20,y+22,12,2,couleur) fr(x+30,y+16,2,4,couleur) fr(x+28,y+20,2,2,couleur) 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") 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=-3 if intervalle==0 and flap==0: wing_power=wing_power+1 intervalle=3 if intervalle==0 and flap>0: wing_power=wing_power+1 intervalle=3 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,couleur_e,couleur) if kd(KEY_SHIFT): fr(150,90,15,40,"white") fr(170,90,15,40,"white") draw_string("[shift]",130,140,"white",couleur) pause=1 sleep(0.5) if kd(KEY_ONOFF): fr(0,0,350,300,"white") fr(0,190,350,1,"grey") fr(0,160,350,1,"grey") draw_string("9.3+6.02 15.32",5,165,"black","white") draw_string("[OK pour revenir]",5,195,"black") sleep(1) draw_string("-6.0003+ ",5,195,"black") while not kd(ko): sleep(0.1) fr(0,0,350,300,couleur) if pause==1: fr(150,90,15,40,"white") fr(170,90,15,40,"white") draw_string("[shift]",130,140,"white",couleur) while pause==1: if kd(KEY_ONOFF): fr(0,0,350,300,"white") fr(0,190,350,1,"grey") fr(0,160,350,1,"grey") draw_string("9.3+6.02 15.32",5,165,"black","white") draw_string("[OK pour revenir]",5,195,"black") sleep(1) draw_string("-6.0003+ ",5,195,"black") while not kd(ko): sleep(0.1) pause=0 fr(0,0,350,300,couleur) sleep(0.001) if kd(KEY_SHIFT): pause=0 sleep(0.2) fr(0,0,350,300,couleur) sleep(0.003) 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,couleur_e,couleur) 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.003) x=320 y=0 for i in range(330): fr(x,y,5,250,couleur_e) fr(x+5,y,5,250,couleur) x=x-1 sleep(0.001) draw_string("BRAVO",130,95,couleur_e,couleur) draw_string("jeu par Aubin",92,110,couleur_e,couleur) draw_string("Ton score: "+str(score),100,128,couleur_e,couleur) draw_string("[OK/UP]:rejouer",80,145,couleur_e,couleur) 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) or kd(ku): fr(0,0,350,250,couleur) 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