fromionimportkeydownfromkandinskyimport*fromrandomimportrandintfromtimeimportsleepliste_cartes=0defsol_grotte(x,y):#is 1
fill_rect(x*18,1+y*18,15,15,"#784212")defherbe(x,y):#is 2
fill_rect(x*18,1+y*18,15,15,"#609B41")defrocher_dehors(x,y):#is 3
fill_rect(x*18,1+y*18,15,15,"#424949")defrocher_grotte(x,y):#is 4
fill_rect(x*18,1+y*18,15,15,"#641E16")defeau_dehors(x,y):#is 5
fill_rect(x*18,1+y*18,15,15,"#0000FF")defeau_grotte(x,y):#is 6
fill_rect(x*18,1+y*18,15,15,"#403AAF")matrice_x=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]matrice_y=[0,1,2,3,4,5,6,7,8,9,10]corrdone=[2,2]coo_carte1=[]coo_carte2=[]coo_carte3=[]coo_carte4=[]coo_carte5=[]defposition_carte(tab):globalcoo_carte1,coo_carte2,coo_carte3,coo_carte4,coo_carte5whilecoo_carte1==[]:a=randint(15,16)b=randint(1,4)iftab[b][a]!=0:coo_carte1=[b,a]whilecoo_carte2==[]:a=randint(3,12)b=randint(1,4)iftab[b][a]!=0:coo_carte2=[b,a]whilecoo_carte3==[]:a=randint(1,16)b=randint(6,9)iftab[b][a]!=0:coo_carte3=[b,a]whilecoo_carte4==[]:a=randint(3,12)b=randint(1,4)iftab[b][a]!=0:coo_carte4=[b,a]whilecoo_carte5==[]:a=randint(1,16)b=randint(6,9)iftab[b][a]!=0:coo_carte5=[b,a]print(coo_carte1)print(coo_carte2)print(coo_carte3)print(coo_carte4)print(coo_carte5)deffont_ecran_generer(tab):foriinrange(11):forvinrange(18):iftab[i][v]==1:sol_grotte(matrice_x[v],matrice_y[i])eliftab[i][v]==2:herbe(matrice_x[v],matrice_y[i])eliftab[i][v]==3:rocher_dehors(matrice_x[v],matrice_y[i])eliftab[i][v]==4:rocher_grotte(matrice_x[v],matrice_y[i])eliftab[i][v]==5:eau_dehors(matrice_x[v],matrice_y[i])eliftab[i][v]==6:eau_grotte(matrice_x[v],matrice_y[i])tipe_zone=2defjoeur(tab,tipe_zone):# 2 == sol and 5 == eau and 1 == solgro
type_zone(corrdone)iftipe_zone==2:fill_rect(tab[0]*18,1+tab[1]*18,15,15,"#C70039")eliftipe_zone==5:fill_rect(tab[0]*18,1+tab[1]*18,15,15,"#222222")eliftipe_zone==1:fill_rect(tab[0]*18,1+tab[1]*18,15,15,"#6C3483")deftype_zone(tab):globaltipe_zoneifcarte_mouv[tab[1]][tab[0]]==2:tipe_zone=2ifcarte_mouv[tab[1]][tab[0]]==5:tipe_zone=5ifcarte_mouv[tab[1]][tab[0]]==1:tipe_zone=1carte_appa=[[3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4],[3,2,2,2,2,2,2,2,2,2,2,2,2,4,1,1,1,4],[3,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,4],[3,2,2,2,2,2,2,2,2,2,2,2,2,4,1,1,1,4],[3,2,2,2,2,2,2,2,2,2,2,2,2,4,1,1,1,4],[3,3,3,5,5,3,3,3,3,3,3,3,3,4,4,1,4,4],[3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,3],[3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,3],[3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,3],[3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,3],[3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3]]carte_mouv=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,2,2,2,2,2,2,2,2,2,2,2,2,0,1,1,1,0],[0,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0],[0,2,2,2,2,2,2,2,2,2,2,2,2,0,1,1,1,0],[0,2,2,2,2,2,2,2,2,2,2,2,2,0,1,1,1,0],[0,0,0,5,5,0,0,0,0,0,0,0,0,0,0,1,0,0],[0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0],[0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0],[0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0],[0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]defmouvement_gauche():ifkeydown(0):ifcarte_mouv[corrdone[1]][corrdone[0]-1]!=0:corrdone[0]=corrdone[0]-1font_ecran_generer(carte_appa)joeur(corrdone,tipe_zone)type_zone(corrdone)defmouvement_droite():ifkeydown(3):ifcarte_mouv[corrdone[1]][corrdone[0]+1]!=0:corrdone[0]=corrdone[0]+1font_ecran_generer(carte_appa)joeur(corrdone,tipe_zone)type_zone(corrdone)defmouvement_haut():ifkeydown(1):ifcarte_mouv[corrdone[1]-1][corrdone[0]]!=0:corrdone[1]=corrdone[1]-1font_ecran_generer(carte_appa)joeur(corrdone,tipe_zone)type_zone(corrdone)defmouvement_bas():ifkeydown(2):ifcarte_mouv[corrdone[1]+1][corrdone[0]]!=0:corrdone[1]=corrdone[1]+1font_ecran_generer(carte_appa)joeur(corrdone,tipe_zone)type_zone(corrdone)joeur(corrdone,tipe_zone)deftoucher_de_carte():globalcorrdone,coo_carte1,coo_carte2,coo_carte3,coo_carte4,coo_carte5,liste_cartesifcoo_carte1[0]==corrdone[1]andcoo_carte1[1]==corrdone[0]:fill_rect(204,202,16,16,"#FF0000")coo_carte1=[-2,-2]liste_cartes+=1print("liste_cartes",liste_cartes)ifcoo_carte2[0]==corrdone[1]andcoo_carte2[1]==corrdone[0]:fill_rect(225,202,16,16,"#FFFF00")coo_carte2=[-20,-20]liste_cartes+=1print("liste_cartes",liste_cartes)ifcoo_carte3[0]==corrdone[1]andcoo_carte3[1]==corrdone[0]:fill_rect(246,202,16,16,"#00FFFF")coo_carte3=[-20,-20]liste_cartes+=1print("liste_cartes",liste_cartes)ifcoo_carte4[0]==corrdone[1]andcoo_carte4[1]==corrdone[0]:fill_rect(267,202,16,16,"#FF00FF")coo_carte4=[-20,-20]liste_cartes+=1print("liste_cartes",liste_cartes)ifcoo_carte5[0]==corrdone[1]andcoo_carte5[1]==corrdone[0]:fill_rect(288,202,16,16,"#00FFFF")coo_carte5=[-20,-20]liste_cartes+=1print("liste_cartes",liste_cartes)defmouvement2(matrice_j):globalcorrdone,zone# Déplacement gauche
ifcarte_mouv[corrdone[1]][corrdone[0]]!=0:toucher_de_carte()mouvement_gauche()mouvement_droite()mouvement_haut()mouvement_bas()defgenere_carte():globalcoo_carte1,coo_carte2,coo_carte3,coo_carte4,coo_carte5fill_rect(coo_carte1[1]*18,1+coo_carte1[0]*18,15,15,"#FF0000")fill_rect(coo_carte2[1]*18,1+coo_carte2[0]*18,15,15,"#FFFF00")fill_rect(coo_carte3[1]*18,1+coo_carte3[0]*18,15,15,"#00FFFF")fill_rect(coo_carte4[1]*18,1+coo_carte4[0]*18,15,15,"#FF00FF")fill_rect(coo_carte5[1]*18,1+coo_carte5[0]*18,15,15,"#00FFFF")defintro():trolle=0txt1="FIND THE RUNE"text_herbe="herbe :"text_sol="sol des grottes :"text_grotte="mur des grottes :"text_roche="mur en roche :"fill_rect(0,0,360,222,"#000000")foryinrange(40):forxinrange(60):fill_rect(x*6,y*6,6,6,(randint(0,254),randint(0,10),randint(0,10)))draw_string(txt1,20+(len(txt1)*10)//2,20,"#FFFFFF","#000000")draw_string(text_herbe,50,70,"#FFFFFF","#000000")fill_rect(220,70,18,18,"#784212")draw_string(text_roche,50,100,"#FFFFFF","#000000")fill_rect(220,100,18,18,"#609B41")draw_string(text_sol,50,130,"#FFFFFF","#000000")fill_rect(220,130,18,18,"#641E16")draw_string(text_grotte,50,160,"#FFFFFF","#000000")fill_rect(220,160,18,18,"#0000FF")draw_string("presse fleche du haut ",50,200,"#FFFFFF","#000000")whiletrolle==0:ifkeydown(1):trolle+=1jeu()defjeu():fill_rect(0,0,320,222,"#000000")font_ecran_generer(carte_appa)position_carte(carte_appa)txt="Carte du Joueur:"draw_string(txt,42,200,"#FFFFFF","#000000")fill_rect(202,200,20,20,"#FFFFFF")fill_rect(223,200,20,20,"#FFFFFF")fill_rect(244,200,20,20,"#FFFFFF")fill_rect(265,200,20,20,"#FFFFFF")fill_rect(286,200,20,20,"#FFFFFF")whileliste_cartes!=5:joeur(corrdone,tipe_zone)toucher_de_carte()genere_carte()mouvement2(carte_mouv)sleep(0.1)finn()deffinn():#fill_rect(0,0,360,222,"#000000")
text="FIN DU JEUX"ttt="tu as trouvé les runes"tm="merci d'avoir jouer <3"foryinrange(40):forxinrange(60):fill_rect(x*6,y*6,6,6,(randint(0,30),randint(0,10),randint(0,254)))sleep(0.0001)draw_string(text,50+(len(text)*10)//2,18,"#FFFFFF","#000000")draw_string(ttt,55,60,"#FFFFFF","#000000")draw_string("la gloire te tent la mains",30,100,"#FFFFFF","#000000")draw_string(tm,50,198,"#FFFFFF","#000000")intro()
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.