from math import * from random import * from kandinsky import * from ion import * from time import * _1=[1,1,0,0,1,0,0,1,0,0,1,0,1,1,1] _2=[1,1,1,0,0,1,1,1,1,1,0,0,1,1,1] _3=[1,1,1,0,0,1,1,1,1,0,0,1,1,1,1] _4=[1,0,1,1,0,1,1,1,1,0,0,1,0,0,1] _5=[1,1,1,1,0,0,1,1,1,0,0,1,1,1,1] _6=[1,1,1,1,0,0,1,1,1,1,0,1,1,1,1] _7=[1,1,1,0,0,1,0,1,1,0,0,1,0,0,1] _8=[1,1,1,1,0,1,1,1,1,1,0,1,1,1,1] _9=[1,1,1,1,0,1,1,1,1,0,0,1,1,1,1] _0=[1,1,1,1,0,1,1,0,1,1,0,1,1,1,1] def draw_chiffre(n,x,y,t,color=(0,0,0),inutile=0): num,a=[_0,_1,_2,_3,_4,_5,_6,_7,_8,_9],0 for i in n:draw(num[int(i)],x+a,y,t,color);a+=4*t def draw(liste,x,y,t,color): k=0 for i in range(y,y+(5*t),t): for j in range(x,x+(3*t),t): if liste[k]:fill_rect(j,i,t,t,color) k+=1 def arriere_plan(n,h,l): fill_rect(0,0,10,200,(0,0,170)) fill_rect(0,0,320,10,(0,0,170)) fill_rect(320,200,-10,-200,(0,0,170)) fill_rect(320,200,-320,-10,(0,0,170)) fill_rect(0,200,320,22,(0,0,0)) draw_blocs(2,202,2) draw_string("x"+str(n)+" ",24,205,(255,)*3,(0,)*3) draw_blocs(298,202,9) if h<10:dec=5 elif h<100:dec=3 else:dec=1 draw_chiffre(str(h),301+dec,210,1,(255,)*3) draw_string("Level "+str(l),125,205,(255,)*3,(0,)*3) fill_rect(50,207,12,2,(255,)*3) fill_rect(50,220,12,2,(255,)*3) fill_rect(48,207,2,20,(255,)*3) fill_rect(61,208,2,2,(255,)*3) fill_rect(62,209,2,2,(255,)*3) fill_rect(63,210,2,2,(255,)*3) fill_rect(64,211,2,2,(255,)*3) fill_rect(65,212,2,2,(255,)*3) fill_rect(66,213,2,2,(255,)*3) fill_rect(66,214,2,2,(255,)*3) fill_rect(65,215,2,2,(255,)*3) fill_rect(64,216,2,2,(255,)*3) fill_rect(63,217,2,2,(255,)*3) fill_rect(62,218,2,2,(255,)*3) fill_rect(61,219,2,2,(255,)*3) for i in range(0,8): fill_rect(51+i,210+i,2,2,(255,)*3) for i in range(0,8): fill_rect(51+i,217-i,2,2,(255,)*3) fill_rect(70,207,10,2,(255,)*3) fill_rect(70,207,10,2,(255,)*3) fill_rect(78,206,1,4,(255,)*3) fill_rect(77,205,1,6,(255,)*3) fill_rect(76,204,1,8,(255,)*3) fill_rect(70,207,2,15,(255,)*3) fill_rect(85,222,-15,-2,(255,)*3) fill_rect(85,222,-2,-15,(255,)*3) perso1=[ [1,1,1,0,0,0,0,0,0,0],#1 [0,1,1,1,1,0,0,0,0,0],#2 [0,0,1,1,1,1,1,0,0,0],#3 [0,0,1,1,1,1,2,0,0,0],#4 [0,0,0,1,1,2,3,2,0,0],#5 [0,0,0,1,2,2,2,2,0,0],#6 [0,0,0,2,2,2,2,2,0,0],#7 [0,0,0,0,2,2,2,0,0,0],#8 [0,0,0,1,1,1,1,1,6,6],#9 [0,0,0,1,4,4,1,1,6,6],#10 [0,0,0,1,4,4,1,1,5,0], [0,0,1,1,4,4,4,5,5,0], [0,0,1,1,1,4,2,5,1,0], [0,0,1,1,1,1,2,2,1,0], [0,1,1,1,1,1,1,1,1,1], [0,1,1,1,1,1,1,1,1,1], [0,1,1,1,1,1,1,1,1,1], [0,1,1,1,1,1,1,1,1,1], [0,0,4,4,4,0,4,4,4,0], [0,0,4,4,4,4,4,4,4,4]] perso2=[ [1,1,1,0,0,0,0,0,0,0],#1 [0,1,1,1,1,0,0,0,0,0],#2 [0,0,1,1,1,1,1,0,0,0],#3 [0,0,1,1,1,1,2,0,0,0],#4 [0,0,0,1,1,2,3,2,0,0],#5 [0,0,0,1,2,2,2,2,0,0],#6 [0,0,0,2,2,2,2,2,0,0],#7 [0,0,0,0,2,2,2,0,0,0],#8 [0,0,0,1,1,1,1,1,0,0],#9 [0,0,0,1,4,4,1,1,0,0],#10 [0,0,0,4,4,4,1,1,6,6], [0,0,1,4,4,1,1,5,5,6], [0,0,1,4,2,5,5,5,1,0], [0,0,1,1,2,2,1,1,1,0], [0,1,1,1,1,1,1,1,1,1], [0,1,1,1,1,1,1,1,1,1], [0,1,1,1,1,1,1,1,1,1], [4,4,1,1,1,1,1,1,4,4], [4,4,4,0,0,0,4,4,4,4], [0,4,4,4,0,0,4,4,4,0]] colors=[(230,255,255),(150,0,255),(0,240,0),(0,0,0),(50,0,150),(150,150,50),(255,180,0),(0,0,255),(0,230,255),(200,230,255)] def personnage1(liste,x,y): global colors for a in range(0,20): for b in range(0,10): fill_rect(x+(b*2),y+(a*2),2,2,colors[liste[a][b]]) def personnage2(liste,x,y): global colors for a in range(0,20): for b in range(0,10): fill_rect(x+(b*2),y+(a*2),2,2,colors[liste[a][9-b]]) bloc=[ [7,7,7,7,3,3,7,7,7,7],#1 [7,7,7,3,7,7,3,7,7,7],#2 [7,7,3,7,7,7,7,3,7,7],#3 [7,3,7,7,7,7,7,7,3,7],#4 [3,7,7,7,7,7,7,7,7,3],#5 [3,7,7,7,7,7,7,7,7,3],#6 [7,3,7,7,7,7,7,7,3,7],#7 [7,7,3,7,7,7,7,3,7,7],#8 [7,7,7,3,7,7,3,7,7,7],#9 [7,7,7,7,3,3,7,7,7,7]]#10 glacon=[ [8,8,8,8,8,8,8,8,9,8],#1 [8,8,9,8,8,8,8,8,8,8],#2 [8,8,8,8,8,9,8,8,8,8],#3 [8,8,8,8,8,8,8,8,8,8],#4 [8,8,8,8,8,8,8,9,8,8],#5 [8,9,8,8,8,8,8,8,8,8],#6 [8,8,8,8,8,8,8,8,8,8],#7 [8,8,8,8,9,8,8,8,8,8],#8 [9,8,8,8,8,8,8,8,8,8],#9 [8,8,8,8,8,8,8,8,8,9]]#10 trampoline=[ [7,7,7,7,7,7,7,7,7,7], [0,3,3,3,0,0,3,3,3,0], [0,0,3,0,0,0,0,3,0,0], [0,0,0,3,0,0,3,0,0,0], [0,0,0,0,3,3,0,0,0,0], [0,0,0,0,3,3,0,0,0,0], [0,0,0,3,0,0,3,0,0,0], [0,0,3,0,0,0,0,3,0,0], [0,3,3,3,0,0,3,3,3,0], [7,7,7,7,7,7,7,7,7,7]] trampoline2=[ [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [7,7,7,7,7,7,7,7,7,7], [0,3,3,3,0,0,3,3,3,0], [0,0,3,3,3,3,3,3,0,0], [0,3,3,3,0,0,3,3,3,0], [7,7,7,7,7,7,7,7,7,7]] feu=[ [0,0,0,0,0,1,0,0,0,0],#1 [0,0,0,0,1,1,0,0,0,0],#2 [0,0,0,1,2,2,1,0,0,0],#3 [0,0,0,1,2,2,2,1,0,0],#4 [0,0,1,2,2,3,2,1,0,0],#5 [0,1,2,2,3,3,2,2,1,0],#6 [0,1,2,3,3,3,3,2,2,1],#7 [1,2,2,3,3,3,3,3,2,1],#8 [1,2,2,2,2,2,2,2,2,1],#9 [1,1,1,1,1,1,1,1,1,1]]#10 colors_feu=[(230,255,255),(255,0,0),(255,180,0),(255,255,0)] def blocs(liste,x,y): global colors for a in range(0,10): for b in range(0,10): fill_rect(x+(b*2),y+(a*2),2,2,colors[liste[a][b]]) def blocs_feu1(liste,x,y): global colors_feu for a in range(0,10): for b in range(0,10): fill_rect(x+(b*2),y+(a*2),2,2,colors_feu[liste[a][b]]) def blocs_feu2(liste,x,y): global colors_feu for a in range(0,10): for b in range(0,10): fill_rect(x+(b*2),y+(a*2),2,2,colors_feu[liste[a][9-b]]) horloge=[ [3,3,3,1,1,1,1,3,3,3], [3,3,1,1,1,1,1,1,3,3], [3,1,1,3,3,3,3,1,1,3], [1,1,3,3,3,3,3,3,1,1], [1,1,3,3,3,3,3,3,1,1], [1,1,3,3,3,3,3,3,1,1], [1,1,3,3,3,3,3,3,1,1], [3,1,1,3,3,3,3,1,1,3], [3,3,1,1,1,1,1,1,3,3], [3,3,3,1,1,1,1,3,3,3]] map=[ [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], [1,0,0,0,0,0,0,0,0,0,0,0,0,0,1], [0,0,0,0,0,0,0,0,0,0,0,0,0,0,1], [0,0,0,3,3,1,1,1,1,1,1,0,0,0,1], [1,1,1,1,1,1,0,0,0,0,1,1,1,0,1], [1,0,0,0,0,0,0,0,0,0,0,0,0,0,1], [1,0,0,0,0,0,0,0,0,0,0,0,0,0,1], [1,1,2,2,0,0,1,1,0,1,2,2,0,5,1], [1,1,1,1,1,3,1,1,3,1,1,1,1,1,1]] def draw_blocs(x,y,n,all=True,all2=True): if n==0:fill_rect(x,y,20,20,(230,255,255)) elif n==1 and all:blocs(bloc,x,y) elif n==2 and all2:blocs(glacon,x,y) elif n==3 and all2:blocs_feu1(feu,x,y) elif n==4 and all2:blocs_feu2(feu,x,y) elif n==5 and all2:blocs(trampoline,x,y) elif n==6 and all2:blocs(trampoline2,x,y) elif n==9:blocs(horloge,x,y) def draw_map(all=True,all2=True): global map for a in range(0,9): for b in range(0,15): if all==False and map[a][b]!=1:draw_blocs((b*20)+10,(a*20)+10,map[a][b],all,all2) else:draw_blocs((b*20)+10,(a*20)+10,map[a][b],all,all2) def change(): global map for a in range(0,9): for b in range(0,15): if map[a][b]==3:map[a][b]=4 elif map[a][b]==4:map[a][b]=3 if map[a][b]==5:map[a][b]=6 elif map[a][b]==6:map[a][b]=5 def personnage(x,y,orient,pos): if orient==0: if pos==0:personnage1(perso1,x,y) else:personnage1(perso2,x,y) else: if pos==0:personnage2(perso1,x,y) else:personnage2(perso2,x,y) def change_level(n): global map if n==1: map=[ [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], [1,0,0,0,0,0,0,0,0,0,0,0,0,0,1], [1,0,0,0,0,0,0,0,0,0,0,0,0,0,1], [1,1,1,1,1,0,1,2,2,2,0,0,0,0,1], [1,0,0,0,1,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1], [1,0,0,6,4,6,0,6,4,4,0,1,0,2,1], [1,0,0,1,1,1,0,1,1,1,0,1,0,1,1], [1,6,0,0,1,0,0,0,1,0,0,1,0,1,1], [1,1,1,4,1,4,6,4,1,4,6,1,6,1,1]] elif n==9: map=[ [1,1,1,0,0,1,1,1,0,0,0,1,1,1,1], [1,0,1,0,0,0,0,1,0,0,0,1,1,1,1], [1,0,0,0,0,0,0,1,0,0,0,1,1,1,1], [2,0,0,0,0,0,0,0,0,0,0,0,0,2,1], [2,0,0,0,0,0,0,0,0,0,0,0,0,2,1], [1,0,0,6,4,4,0,0,0,0,0,1,0,2,1], [1,0,0,1,1,1,0,0,0,0,0,1,0,1,1], [1,6,0,0,1,0,0,0,0,0,0,1,0,1,1], [1,1,1,4,1,4,6,4,4,4,6,1,6,1,1]] elif n==10: map=[ [2,0,0,0,0,0,0,0,1,0,0,0,0,0,1], [2,0,0,0,0,0,0,0,0,0,0,0,0,0,1], [2,0,0,0,0,0,1,0,0,0,0,1,0,0,1], [2,0,0,0,0,0,0,0,0,0,0,0,0,0,1], [2,0,0,0,0,0,0,0,4,0,0,0,0,0,1], [1,0,0,0,4,6,0,4,1,0,0,4,6,0,1], [1,0,0,0,0,0,0,0,1,0,0,0,0,0,1], [1,6,4,2,0,0,0,0,1,0,0,0,0,0,1], [1,1,1,1,4,1,6,4,1,4,4,4,1,6,1]] def menu(): arriere_plan(3,10,0) draw_string("TUTORIAL",120,202,(255,)*3,(0,)*3) fill_rect(10,10,300,180,(230,255,255)) draw_string("Fire & Ice",110,2,(0,255,255),(0,0,170)) personnage(150,20,0,0) draw_string(">:RIGHT",170,30,(0,0,255),(230,255,255)) draw_string("LEFT:<",90,30,(0,0,255),(230,255,255)) draw_string("DOWN to take/place a ice block",10,60,(0,0,255),(230,255,255)) draw_blocs(30,80,1) draw_blocs(30,105,2) draw_blocs(30,130,3) draw_blocs(30,155,5) draw_blocs(160,80,9) draw_string("> block",50,80,(0,0,255),(230,255,255)) draw_string("> ice block",50,105,(0,0,255),(230,255,255)) draw_string("> fire block",50,130,(0,0,255),(230,255,255)) draw_string("> jump block",50,155,(0,0,255),(230,255,255)) draw_string("> clock time",180,80,(0,0,255),(230,255,255)) draw_string("Create",220,140,(0,0,255),(200,230,255)) draw_string("by Merle",210,158,(0,0,255),(200,230,255)) draw_string("<OK> to continue.",75,180,(0,255,255),(0,0,170)) while not keydown(KEY_OK):pass while keydown(KEY_OK):pass menu() LEFT =KEY_LEFT UP =KEY_UP DOWN =KEY_DOWN RIGHT=KEY_RIGHT OK =KEY_OK neige=0 level=1 time=90 maxlevel=10 arriere_plan(0,time,1) draw_map(True,True) t=monotonic() tt=monotonic() draw_objet=True orientation=0 position=0 moved=False redraw=True posxy=[230,110] posmap=[6,11] personnage(posxy[0],posxy[1],orientation,position) while level<=maxlevel: if redraw:draw_map(False,draw_objet);personnage(posxy[0],posxy[1],orientation,position);redraw=False if map[posmap[0]+1][posmap[1]]==0:posmap[0]+=1;posxy[1]+=20;redraw=True if keydown(KEY_BACKSPACE) or time<1 or map[posmap[0]+1][posmap[1]]==4 or map[posmap[0]+1][posmap[1]]==3:draw_string("GAME OVER",115,202,(255,)*3,(0,)*3);sleep(1);posxy=[30,30];change_level(level);posmap=[2,1];draw_map(True,True);t=monotonic();tt=monotonic();draw_objet=True;time=90-(level*2);neige=0 if monotonic()-tt>0.5: feux=False for a in range(0,9): for b in range(0,15): if map[a][b]==2 and a<8 and(map[a+1][b]==0 or map[a+1][b]==4 or map[a+1][b]==3):map[a][b]=0;map[a+1][b]=2;redraw=True if map[a][b]==3 or map[a][b]==4:feux=True;redraw=True tt=monotonic() if posmap[1]==0 and feux==False:level+=1;posxy=[30,30];posmap=[2,1];change_level(level);draw_map(True,True);t=monotonic();tt=monotonic();draw_objet=True;time=90 if keydown(KEY_ALPHA):level+=1;posxy=[30,30];posmap=[2,1];change_level(level);draw_map(True,True);t=monotonic();tt=monotonic();draw_objet=True;time=90 if keydown(KEY_SHIFT):neige+=1 if keydown(DOWN)or keydown(UP)or keydown(LEFT)or keydown(RIGHT)or keydown(OK): moved=True if keydown(OK)and map[posmap[0]-2][posmap[1]]==0: if map[posmap[0]+1][posmap[1]]==5 or map[posmap[0]+1][posmap[1]]==6:posxy[1]-=40;posmap[0]-=2 moved=False;redraw=True;posxy[1]-=20;posmap[0]-=1 if keydown(DOWN)and orientation==1 and map[posmap[0]+1][posmap[1]-1]==2 and posmap[1]!=0 and posmap[0]!=7:neige+=1;map[posmap[0]+1][posmap[1]-1]=0;redraw=True elif keydown(DOWN)and orientation==0 and map[posmap[0]+1][posmap[1]+1]==2 and posmap[1]!=0 and posmap[0]!=7:neige+=1;map[posmap[0]+1][posmap[1]+1]=0;redraw=True elif keydown(DOWN) and(map[posmap[0]+1][posmap[1]-1]==0 or map[posmap[0]+1][posmap[1]+1]==0)and neige>0: if orientation==1 and neige!=0 and posmap[1]!=0:map[posmap[0]+1][posmap[1]-1]=2 elif orientation==0 and neige!=0 and posmap[1]!=0:map[posmap[0]+1][posmap[1]+1]=2 redraw=True;neige-=1 elif keydown(DOWN) and(map[posmap[0]+1][posmap[1]-1]==4 or map[posmap[0]+1][posmap[1]+1]==4)and neige>0: if orientation==1 and neige!=0 and posmap[1]!=0:map[posmap[0]+1][posmap[1]-1]=2 elif orientation==0 and neige!=0 and posmap[1]!=0:map[posmap[0]+1][posmap[1]+1]=2 redraw=True;neige-=1 elif keydown(DOWN) and(map[posmap[0]+1][posmap[1]-1]==3 or map[posmap[0]+1][posmap[1]+1]==3)and neige>0: if orientation==1 and neige!=0 and posmap[1]!=0:map[posmap[0]+1][posmap[1]-1]=2 elif orientation==0 and neige!=0 and posmap[1]!=0:map[posmap[0]+1][posmap[1]+1]=2 redraw=True;neige-=1 if keydown(LEFT)and orientation==1 and map[posmap[0]][posmap[1]-1]==0 and map[posmap[0]-1][posmap[1]-1]==0 and posmap[1]!=0: posxy[0]-=20;posmap[1]-=1 elif keydown(RIGHT)and orientation==0 and map[posmap[0]][posmap[1]+1]==0 and map[posmap[0]-1][posmap[1]+1]==0: posxy[0]+=20;posmap[1]+=1 elif keydown(LEFT):orientation=1 elif keydown(RIGHT):orientation=0 else:moved=False press=True while press: if keydown(DOWN)or keydown(UP):press=True else:press=False draw_objet=False if monotonic()-t>1: t=monotonic();draw_objet=True;redraw=True;time-=1 change();arriere_plan(neige,time,level) if moved:position=(position+1)%2;moved=False;redraw=True;sleep(0.1) draw_string("!YOU WON!",115,202,(255,)*3,(0,)*3)