Jeu d’aventure
Utilisez les flèches, [Ok] et [Retour] pour jouer
Attention utilise ( https://my.numworks.com/python/alexandre-merle/moteur_graphique ) pour fonctionner. Il n’est pas terminé
Bonne aventure!
from ion import * from math import * from time import * from random import * from moteur_graphique import * from kandinsky import * import micropython as mp mp.kbd_intr(KEY_EXE) def keydownlist(L): for i in L: if keydown(i):return True def spell_string(t,x,y,c1=(255,)*3,c2=(0,)*3): for i in range(len(t)): draw_string(t[i],x+(i*10),y,c1,c2) sleep(.04) def Text(t): for i in t: fill_rect(0,200,320,22,(0,)*3) spell_string(i,0,203) while not keydown(KEY_OK):1 TEXT=[["PNJ: HELLO! I'AM A STATUE...","YOU: WHAT?! A STATUE WHO SPEAK!?","PNJ: THERE IS A HIDEN TREASURE.","PNJ: USE ACIDE TO...","PNJ: ...DESTROY ME?!","PNJ: USE YOUR BOTTLE WITH...","PNJ: ...DOWN ARROW."],["YOU FIND A MINI-BOAT,","3 PLANKS AND 5 BERRYS!"],["PNJ: HELLO! I'HUNGRY...","PNJ: ...GIVE ME 10 BERRYS!"],["PNJ: THANKS,TAKE THESE 3 PLANKS.","PNJ: YOU CAN USE THESE...","PNJ: ...PLANKS TO BRIDGE ON...","PNJ: ...ACID LAKES."],["PNJ: I'AM DEAD!...","PNJ: ...NICE TO MEET YOU!"],["YOU FIND A CRYSTAL...","...AND 3 PLANKS!"],["YOU FIND A KNIFE!"],["PNJ: HELLO! HAVE YOU EVER...","PNJ: ...CLIMED ON ROPE.","PNJ: IF YOU GIVE ME 10 VINES,","PNJ: I'LL GIVE YOU 1 ROPE METER."],["PNJ: THANKS, TAKE THIS ROPE METER."]] ALLOW=[ False, False, False, 0,#[BERRYS 0,#]PLANKS 0,#{CRYSTALS 0,#}VINES 0,#(LEN ROPE ] Map=Grid WAIT=0.02 LOOP=0 SHIP,DEC=0,0 TYPE="MAP" X,Y,P,O=-188,-72,0,1 allowtile="0T456789VvbB*" GAMEND=False REDRAW=True while not GAMEND: COOR=[(148-X)//24,(96-Y)//24] if REDRAW: REDRAW=False MAP(Map,X,Y,LOOP) Player(ListPlr[SHIP+P],148,96+DEC,2,O,Colors) # draw_string(str(X)+";"+str(Y),0,0) if Map[COOR[1]+1][COOR[0]]=="a"and Map[COOR[1]][COOR[0]]=="7": fill_rect(0,0,320,222,(0,)*3) draw_string("GAMEOVER",120,102,(255,)*3,(0,)*3) GAMEND=True break if keydown(KEY_OK): nextile=Map[COOR[1]][COOR[0]+O] nextile_=Map[COOR[1]+1][COOR[0]+O] if nextile_=="2"and nextile=="9"and ALLOW[6]!=0: ALLOW[6]-=1 set_block(Map,COOR[0]+O,COOR[1],"v") elif nextile in"Vv"and ALLOW[1]: DEC=0 while Map[COOR[1]-DEC][COOR[0]+O]in"Vvb": if Map[COOR[1]-DEC][COOR[0]+O]=="b":ALLOW[3]+=1 set_block(Map,COOR[0]+O,COOR[1]-DEC,"9") DEC+=1 ALLOW[6]+=1 DEC=0 elif nextile_=="a"and nextile=="7"and ALLOW[4]>=1: set_block(Map,COOR[0]+O,COOR[1],"B") ALLOW[4]-=1 elif nextile=="p"and ALLOW[3]<10: Text(TEXT[2]) elif nextile=="p": Text(TEXT[3]) ALLOW[3]-=10 ALLOW[4]+=3 elif nextile=="P"and not ALLOW[2]: Text(TEXT[0]) elif nextile=="P"and ALLOW[2]: Text(TEXT[4]) ALLOW[2]=False set_block(Map,COOR[0]+O,COOR[1],"7") elif nextile=="!"and ALLOW[6]<10: Text(TEXT[7]) elif nextile=="!": Text(TEXT[8]) ALLOW[6]-=10 ALLOW[7]+=1 elif nextile=="C"and TYPE=="DIRT": Text(TEXT[1]) ALLOW[0]=True ALLOW[3]+=5 ALLOW[4]+=3 set_block(Map,COOR[0]+O,COOR[1],"9") elif nextile=="c"and TYPE=="CAVE": Text(TEXT[5]) ALLOW[5]+=1 ALLOW[4]+=6 set_block(Map,COOR[0]+O,COOR[1],"7") elif nextile=="C"and TYPE=="CAVE2": Text(TEXT[6]) ALLOW[1]=True set_block(Map,COOR[0]+O,COOR[1],"9") elif nextile=="5": set_block(Map,COOR[0]+O,COOR[1],"4") ALLOW[3]+=1 elif nextile=="b": set_block(Map,COOR[0]+O,COOR[1],"V") ALLOW[3]+=1 while keydown(KEY_OK):1 REDRAW=True if keydownlist((KEY_LEFT,KEY_RIGHT)): O=-1 if keydown(KEY_LEFT)else 1 nextile1=Map[COOR[1]+1][COOR[0]+O] nextile2=Map[COOR[1]][COOR[0]+O] nextile3=Map[COOR[1]-1][COOR[0]+O] nextile4=Map[COOR[1]-1][COOR[0]] Yl=[] SHIP,DEC=0,0 if nextile1=="o"and ALLOW[0]:SHIP=2;DEC=2 elif nextile2=="B":DEC=-2 elif nextile1=="o":continue if nextile1 in allowtile and nextile2 in allowtile:Yl=[2,4,7,11] elif nextile2 in allowtile+"Hh":Yl=[0,]*4 elif nextile3 in allowtile and nextile4 in allowtile:Yl=[-11,-7,-4,-2] if len(Yl)==4: for i in range(0,4): X-=O*6 Y-=Yl[i] MAP(Map,X,Y,LOOP+i) Player(ListPlr[SHIP+(i+1)%2],148,96+DEC,2,O,Colors) sleep(WAIT) elif keydownlist((KEY_DOWN,KEY_UP)): o=-1 if keydown(KEY_UP)else 1 nextile_=Map[COOR[1]+o][COOR[0]] if nextile_=="a":ALLOW[2]=True;continue elif nextile_=="o":ALLOW[2]=None;continue elif Map[COOR[1]][COOR[0]]=="v"and ALLOW[2]==None: ALLOW[2]=False REDRAW=True DEC=0 while Map[COOR[1]-DEC][COOR[0]]in"9v": set_block(Map,COOR[0],COOR[1]-DEC,choice("Vb")) DEC+=1 DEC=0 elif Map[COOR[1]][COOR[0]]=="4"and ALLOW[2]==None: set_block(Map,COOR[0],COOR[1],"5") ALLOW[2]=False if nextile_ in"Hh": for i in range(0,4): Y-=o*6 MAP(Map,X,Y,LOOP+i) Player(ListPlr[4],148,96,2,((i%2)*2)-1,Colors) sleep(WAIT) if keydown(KEY_BACK): fill_rect(0,0,320,222,(0,)*3) draw_string("INVENTORY",115,0,(255,)*3,(0,)*3) fill_rect(0,20,320,1,(255,)*3) Blocks("[",10,24);draw_string("x"+str(ALLOW[3]),36,26,(255,)*3,(0,)*3) Blocks("]",10,50);draw_string("x"+str(ALLOW[4]),36,52,(255,)*3,(0,)*3) Blocks("}",10,76);draw_string("x"+str(ALLOW[6]),36,78,(255,)*3,(0,)*3) if ALLOW[2]==False:Blocks("=",170,24);draw_string("EMPTY",196,26,(255,)*3,(0,)*3) elif ALLOW[2]==True:Blocks(">",170,24);draw_string("ACID",196,26,(255,)*3,(0,)*3) elif ALLOW[2]==None:Blocks("<",170,24);draw_string("WATER",196,26,(255,)*3,(0,)*3) if ALLOW[1]:Blocks("{",170,50);draw_string("KNIFE",196,52,(255,)*3,(0,)*3) if ALLOW[7]!=0:draw_string(str(ALLOW[7])+" ROPE METERS",170,76,(255,)*3,(0,)*3) #draw_string("CRYSTALS: "+str(ALLOW[5]),10,156,(255,)*3,(0,)*3) while keydown(KEY_BACK):1 while not keydown(KEY_BACK):1 while keydown(KEY_BACK):1 REDRAW=True nextile=Map[COOR[1]][COOR[0]] if nextile=="6": if TYPE=="MAP": Map=Cave TYPE="CAVE" X,Y=-140,-96 elif TYPE=="CAVE": Map=Grid TYPE="MAP" X,Y=-908,-120 REDRAW=True elif nextile=="*": if TYPE=="CAVE": Map=Cave2 TYPE="CAVE2" X,Y=-404,-24 elif TYPE=="CAVE2": Map=Cave TYPE="CAVE" X,Y=-20,-120 REDRAW=True elif nextile=="8": if TYPE=="MAP": Map=Dirt TYPE="DIRT" X,Y=-380,-96 elif TYPE=="DIRT": Map=Grid TYPE="MAP" X,Y=-20,-72 REDRAW=True LOOP+=1