fromrandomimport*fromkandinskyimport*fromionimport*fromtimeimport*cx=-2vie=100armure=80ex=(0,0)direction=(0,0)break_mode=((4,3,0,3,4),(0,0,2,0,0),(3,0,1,0,3),(4,0,2,2,0),(0,3,0,0,4),)map=[[0,5,5,5,0,0,0,1,3,3,3,10,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,1,2,3,11,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,0,0,0,0,1,0,0,0,0,0,15,16,16,14,16,16,16,16,16,16,16,16,16,16,16,16,16,16,15],[0,5,4,5,0,0,1,2,3,11,3,3,3,10,1,1,0,1,1,1,0,0,0,0,0,0,5,5,4,5,5,0,0,0,1,2,3,3,9,3,3,2,1,0,0,0,0,0,1,13,13,13,1,0,0,5,5,4,4,5,5,0,0,1,2,1,0,0,0,0,15,16,0,14,0,16,16,0,0,0,0,0,16,16,16,16,16,16,15],[1,0,4,0,0,1,2,3,10,9,3,11,3,3,3,2,1,2,2,2,1,0,0,0,1,0,0,0,4,0,0,0,1,1,2,10,3,12,3,10,3,3,2,1,0,0,0,1,2,2,13,13,2,1,0,0,0,4,4,0,0,0,1,2,3,2,1,0,0,0,15,16,0,14,0,0,0,0,16,16,16,16,16,16,16,16,16,16,15],[2,1,2,1,1,3,3,3,3,3,12,3,3,11,3,3,2,3,3,2,2,1,1,1,2,1,1,1,1,1,1,1,2,2,3,11,3,11,3,3,3,10,3,2,1,1,1,2,2,14,15,13,3,2,1,1,1,1,1,1,1,1,2,3,3,3,2,1,1,1,15,16,16,16,16,16,16,16,16,14,14,14,16,16,16,16,16,16,15]]max_map=len(map[1])blocks=(("air",10000,0,1,1,((0,0,50,50,(130,230,255)),)),("gazon",10,4,0,0,((0,10,50,40,(190,90,0)),(0,0,50,10,(0,220,0)))),("terre",10,4,0,0,((0,0,50,50,(190,90,0)),)),("pierre",40,2,0,0,((0,0,50,50,(180,180,180)),)),("buche",20,3,0,0,(((0,0,50,50,(200,100,10)),(20,0,10,50,(210,110,20))))),("feuille",2,3,0,0.75,((0,0,50,50,(100,120,0)),)),(),#("table",15,3,0,0,()),
("planche",15,3,0,0,((0,0,50,50,(230,130,40)),(0,20,50,10,(210,110,20)),)),(),#("four",30,2,0,0,()),
("torche",10,3,1,1,((0,0,50,50,(130,230,255)),(20,20,10,30,(200,100,10)),(20,20,10,10,(255,255,0)))),("minerai_charbon",50,2,0,0,((0,0,50,50,(180,180,180)),(10,30,10,10,(20,20,20)),(30,10,10,10,(20,20,20)))),("minerai_fer",50,2,0,0,((0,0,50,50,(180,180,180)),(10,30,10,10,(250,100,100)),(30,10,10,10,(250,100,100)))),("diamant",40,2,0,0,((0,0,50,50,(180,180,180)),(10,30,10,10,(0,255,255)),(30,10,10,10,(0,255,255)))),("eau",10000,5,0.75,0.5,((0,0,50,50,(0,0,180)),)),("lave",10000,5,0.25,1,((0,0,50,50,(255,100,0)),)),("obsidienne",200,2,0,0,((0,0,50,50,(0,0,20)),)),("pierre_trefond",40,2,0,0,((0,0,50,50,(250,20,0)),)),#("spawner",200,2,0,0,()),
#("pierre_ender",80,2,0,0,((0,0,50,50,(235,235,235)),)),
#("toile",20,1,0.2,0.9,((0,0,50,50,(130,230,255)),(0,10,40,10,(230,230,230)),(30,0,10,40,(230,230,230)),(10,30,40,10,(230,230,230)),(10,10,10,40,(230,230,230))))
)inv=[[0,1,2,3,4,13],[31,41,51,32,42,52],[9,7,61,62,63,64]]select=0selectY=0defcasser(outil=0):ifnot-1<p.y+direction[1]<4:returnblock=blocks[map[p.y+direction[1]][(p.x+direction[0])%max_map]]outil_destine=block[2]temps=0.2*block[1]/10ifoutil!=0:ifoutil_destine==outil%10:temps/=2else:temps*=2temps/=(int(outil/10)-3)+1ifblock[1]==10000:returnforhinrange(1,5):foriinrange(0,5):forjinrange(0,5):ifh==break_mode[i][j]:fill_rect(50*(p.x-cx+direction[0])+10*i,50*(p.y+direction[1])+10*j,10,10,(0,0,0))sleep(temps)map[p.y+direction[1]][(p.x+direction[0])%max_map]=0classPerso():def__init__(self):self.x=0self.y=0defmove(self,x,y):globaldirection,cxdirection=(x,y)ifkeydown(KEY_ONOFF)or(self.y+yin(-1,4)):returnifblocks[map[(self.y+y)%4][(self.x+x)%max_map]][3]>0:self.x+=xself.y+=yifcx+4<self.xorself.x<cx+1:cx+=xdefdraw(self):rx=(self.x-cx)*50ry=self.y*50fill_rect(rx+15,ry+10,20,40,(255,0,255))fill_rect(rx+15,ry,20,20,(250,160,130))fill_rect(rx+18,ry+5,5,5,(255,255,255))fill_rect(rx+27,ry+5,5,5,(255,255,255))fill_rect(rx+19+(direction[0]),ry+6+(direction[1]),3,3,(0,0,255))fill_rect(rx+28+(direction[0]),ry+6+(direction[1]),3,3,(0,0,255))if0<inv[0][select%6]<20:block=blocks[inv[0][select]]forkinblock[5]:fill_rect(int(30+rx+(k[0]*1/5)),int(30+ry+(k[1]*1/5)),int(k[2]*1/5),int(k[3]*1/5),k[4])if30<inv[0][select%6]<70:draw_outil(30+rx,30+ry,1/5,inv[0][select%6]-30)p=Perso()defdraw():ifopen_inv:draw_inv()bouger_inv()returnelse:foriinrange(0,4):forjinrange(0,7):block=blocks[map[i][(j+(cx))%max_map]]forkinblock[5]:fill_rect(k[0]+(j*50),k[1]+(i*50),k[2],k[3],k[4])p.draw()ifarmure!=ex[0]orvie!=ex[1]:draw_life()defdraw_life():globalexex=(armure,vie)fill_rect(0,200,320,22,(255,255,255))fill_rect(0,200,int(armure/100*320),22,(120,120,150))fill_rect(3,203,int(vie/100*314),16,(255,0,0))drawed_inv=0defdraw_inv():globaldrawed_invifdrawed_inv:returnfill_rect(20,20,280,160,(125,225,250))foriinrange(0,6):forjinrange(0,3):ifi==selectandj==selectY:fill_rect(27+i*45-5,10*(j!=0)+30+j*45-5,50,50,(220,200,200))if0<=inv[j][i]<20:block=blocks[inv[j][i]]forkinblock[5]:fill_rect(int(27+i*45+(k[0]*4/5)),int(10*(j!=0)+30+j*45+(k[1]*4/5)),int(k[2]*4/5),int(k[3]*4/5),k[4])elif30<inv[j][i]<70:draw_outil(27+i*45,10*(j!=0)+30+j*45,4/5,inv[j][i]-30)else:fill_rect(27+i*45,10*(j!=0)+30+j*45,40,40,(0,0,0))drawed_inv=1open_inv=0defdraw_outil(x,y,scale,id):couleur=((200,100,10),(180,180,180),(235,235,235),(0,255,255))[int(id/10)]ifid%10==1:fill_rect(x+int(15*scale),y+int(5*scale),int(20*scale),int(30*scale),couleur)fill_rect(x+int(20*scale),y+int(35*scale),int(10*scale),int(15*scale),(220,120,30))ifid%10==2:fill_rect(x+int(5*scale),y+int(5*scale),int(40*scale),int(10*scale),couleur)fill_rect(x+int(20*scale),y+int(15*scale),int(10*scale),int(30*scale),(220,120,30))ifid%10==3:fill_rect(x+int(20*scale),y,int(25*scale),int(10*scale),couleur)fill_rect(x+int(30*scale),y+int(10*scale),int(15*scale),int(10*scale),couleur)fill_rect(x+int(20*scale),y+int(10*scale),int(10*scale),int(35*scale),(220,120,30))ifid%10==4:fill_rect(x+int(15*scale),y+int(5*scale),int(20*scale),int(20*scale),couleur)fill_rect(x+int(20*scale),y+int(25*scale),int(10*scale),int(25*scale),(220,120,30))defbouger_inv():globalselect,selectY,drawed_invifnotopen_inv:returnforiinrange(18):ifkeydown(i+12):ifkeydown(KEY_OK):inv[int(i/6)][i%6],inv[selectY][select]=inv[selectY][select],inv[int(i/6)][i%6]else:selectY=int(i/6)select=i%6foriinrange(4):ifkeydown(i):select=(select+(-1,0,0,1)[i])%6selectY=(selectY+(0,-1,1,0)[i])%3drawed_inv=0draw_inv()whileTrue:draw()sleep(0.2)ifkeydown(KEY_HOME):drawed_inv=0open_inv=1-open_invifopen_inv:continueifp.y<3:ifblocks[map[(p.y+1)%4][p.x%max_map]][3]==1andp.y<3:p.y+=1ifmap[p.y][p.x%max_map]==14:vie-=10-(5*(vie<=armure))foriinrange(6):ifkeydown(12+i):select=iifkeydown(KEY_OK):if0<inv[0][select%6]<20:ifmap[(p.y+direction[1])%4][(p.x+direction[0])%max_map]in(0,13,14):map[(p.y+direction[1])%4][(p.x+direction[0])%max_map]=inv[0][select]else:casser(inv[0][select%6])ifkeydown(KEY_UP)and(map[(p.y+1)%4][p.x%max_map]!=0orp.y==3):p.move(0,-1)ifkeydown(KEY_DOWN):p.move(0,1)ifkeydown(KEY_LEFT):p.move(-1,0)ifkeydown(KEY_RIGHT):p.move(1,0)#COMMENT JOUER:
#1) On se deplace avec les fleches.
#2) On peut changer la direction du
# regard en appuyant sur le bouton off
# et la fleche voulue.
#3) On peut ouvrir et fermer l'inventaire
# avec la touche "home"
#4)On selectionne quelque chose dans l'inventaire avec la touche correspondante parmi les trois premieres lignes du clavier.
#5)Pour changer le place d'un outil on selectionne cet outil, on appuie sur "'OK" et en même temps on appuie sur la touche correspondante à la case où vous voulez qu'il arrive.
#6)# Type your text here
During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:
Ensure the proper functioning of the site (essential cookies); and
Track your browsing to send you personalized communications if you have created a professional account on the site and can be contacted (audience measurement cookies).
With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.