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,0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,2,4,4,4,4,4,4,0,0,0,0,0,0,1,0,4,4,4,4,4,4,4,0,0,0,0,0,0,1,2,4,4,4,4,4,4,4,4,0,0,0,0,0,1,1,4,4,4,4,4,4,4,4,0,1,0,0,0,2,1,2,4,4,4,4,4,2,2,1,1,0,0,0,2,1,2,2,4,4,4,2,2,2,1,0,0,3,0,2,2,4,2,2,4,2,2,2,4,1,0,3,2,0,2,2,4,4,2,2,2,4,2,2,2,3,2,2,0,0,2,4,4,4,4,4,4,2,2,3,2,2,2,0,0,2,4,4,4,4,4,4,2,3,2,2,2,2,0,0,4,2,4,4,4,4,4,3,2,2,2,2,0,0,2,4,4,2,2,2,2,2,2,3,2,2,0,0,2,2,4,4,4,4,4,4,4,4,4,3,0,0,0,2,2,2,0,0,0,0,4,4,4,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,0,0]defdraw_zelda(list,x,y):x1=x;y1=yforiinlist:ifi!=0:fill_rect(x1,y1,2,2,colors[i])x1+=2ifx1>x+28:y1+=2;x1-=30defdraw_zelda_eppee3(list,x,y):y-=18;x1=x;y1=yforiinlist:ifi!=0:fill_rect(x1,y1,2,2,colors[i])x1+=2ifx1>x+28:y1+=2;x1-=30defdraw_zelda_eppee(list,x,y):x-=18;x1=x;y1=yforiinlist:ifi!=0:fill_rect(x1,y1,2,2,colors[i])x1+=2ifx1>x+46:y1+=2;x1-=48defdraw_zelda2(list,x,y):x+=28;x1=x;y1=yforiinlist:ifi!=0:fill_rect(x1,y1,2,2,colors[i])x1-=2ifx1<x-28:y1+=2;x1+=30defdraw_zelda_eppee2(list,x,y):x+=48;x1=x;y1=yforiinlist:ifi!=0:fill_rect(x1,y1,2,2,colors[i])x1-=2ifx1<x-46:y1+=2;x1+=48defzelda(n,x,y):ifn==1:draw_zelda(_down1,x,y)ifn==2:draw_zelda(_down2,x,y)ifn==3:draw_zelda(_epee_down,x,y)ifn==4:draw_zelda(_left1,x,y)ifn==5:draw_zelda(_left2,x,y)ifn==6:draw_zelda_eppee(_epee_left,x,y)ifn==7:draw_zelda(_up,x,y)ifn==8:draw_zelda2(_up,x,y)ifn==9:draw_zelda_eppee3(_epee_up,x,y)ifn==10:draw_zelda2(_left1,x,y)ifn==11:draw_zelda2(_left2,x,y)ifn==12:draw_zelda_eppee2(_epee_left,x,y)defperdu(x,y):r=0v=0b=0forjinrange(5):foriinrange(0,4):fill_rect(0,0,320,222,(255-r,235-v,150-b));zelda((i*3)+1,x,y);sleep(0.1);r+=12;v+=11;b+=7fill_rect(0,0,320,222,(255-r,235-v,150-b))#Crabe
b=[bg_color,(0,0,255),(255,)*3,(200,200,255)]r=[bg_color,(255,0,0),(255,)*3,(255,200,150)]crabe1=[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,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,0,0,1,1,0,0,0,0,0,1,1,1,2,2,2,2,1,1,1,0,0,0,0,0,0,1,2,2,1,2,2,1,2,2,1,0,0,0,1,1,1,1,2,1,1,2,2,1,1,2,1,1,1,1,0,1,1,2,2,1,1,2,2,1,1,2,2,1,1,0,0,0,1,2,2,1,2,2,2,2,1,2,2,1,0,0,0,1,1,1,2,2,1,1,1,1,2,2,1,1,1,0,1,1,1,1,3,1,1,1,1,1,1,3,1,1,1,1,0,0,1,1,1,1,3,1,1,3,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1,3,1,1,1,1,3,1,1,0,1,1,0,0,0,0,0,1,1,3,3,1,1,0,0,0,0,0]crabe2=[0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,0,1,1,0,0,0,0,0,0,1,1,1,2,2,2,2,1,1,1,0,0,0,0,1,0,1,2,2,1,2,2,1,2,2,1,0,1,0,0,1,1,1,2,1,1,2,2,1,1,2,1,1,1,0,0,0,1,2,2,1,1,2,2,1,1,2,2,1,0,0,0,1,1,2,2,1,2,2,2,2,1,2,2,1,1,0,1,1,1,1,2,2,1,1,1,1,2,2,1,1,1,1,0,0,1,1,3,1,1,1,1,1,1,3,1,1,0,0,0,1,1,1,1,1,3,1,1,3,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,3,1,1,1,1,3,1,1,0,0,0,0,0,0,0,0,1,1,3,3,1,1,0,0,0,0,0]defdraw_crabe_up(list1,list2,x,y):x1=x;y1=yforiinlist1:ifi!=0:fill_rect(x1,y1,2,2,list2[i])x1+=2ifx1>x+30:y1+=2;x1=xdefdraw_crabe_left(list1,list2,x,y):x1=x;y1=yforiinlist1:ifi!=0:fill_rect(x1,y1,2,2,list2[i])y1+=2ify1>y+30:x1+=2;y1=ydefdraw_crabe_down(list1,list2,x,y):x1=x;y1=y+30foriinlist1:ifi!=0:fill_rect(x1,y1,2,2,list2[i])x1+=2ifx1>x+30:y1-=2;x1=xdefdraw_crabe_right(list1,list2,x,y):x1=x+30;y1=yforiinlist1:ifi!=0:fill_rect(x1,y1,2,2,list2[i])y1+=2ify1>y+30:x1-=2;y1=ydefcrabe(n,x,y,c):ifn==1:draw_crabe_down(crabe1,c,x,y)ifn==2:draw_crabe_down(crabe2,c,x,y)ifn==3:draw_crabe_left(crabe1,c,x,y)ifn==4:draw_crabe_left(crabe2,c,x,y)ifn==5:draw_crabe_up(crabe1,c,x,y)ifn==6:draw_crabe_up(crabe2,c,x,y)ifn==7:draw_crabe_right(crabe1,c,x,y)ifn==8:draw_crabe_right(crabe2,c,x,y)defboulecrabe(x,y):fill_rect(x-5,y-5,42,42,bg_color)fill_rect(x+10,y+8,12,16,colors[2])fill_rect(x+8,y+10,16,12,colors[2])_life=[0,0,1,1,0,2,2,0,0,0,3,3,0,4,4,0,0,0,5,5,0,6,6,0,0,0,1,1,1,1,2,2,2,0,3,3,3,3,4,4,4,0,5,5,5,5,6,6,6,0,0,1,1,1,2,2,2,2,0,3,3,3,4,4,4,4,0,5,5,5,6,6,6,6,0,0,0,1,1,1,2,2,0,0,0,3,3,3,4,4,0,0,0,5,5,5,6,6,0,0,0,0,0,1,2,2,0,0,0,0,0,3,4,4,0,0,0,0,0,5,6,6,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,5,0,0,0,0]defdraw_life(x,y,l):x1=x;y1=yforiin_life:ifi==0:fill_rect(x1,y1,2,2,(50,50,50))ifi<=landi!=0:fill_rect(x1,y1,2,2,(255,0,0))elifi>l:fill_rect(x1,y1,2,2,(150,0,0))x1+=2ifx1>x+48:y1+=2;x1=x_bombe=[bg_color,(0,0,255),(230,230,255),colors[3]]bombe=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,1,0,3,3,3,0,0,0,0,0,1,1,1,1,0,1,1,1,3,3,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0]defdraw_bombe(x,y):x1=x+8;y1=y+8foriinbombe:ifi!=0:fill_rect(x1,y1,1,1,_bombe[i])x1+=1ifx1>x+23:y1+=1;x1=x+8defbarre(l,n__b):fill_rect(0,0,320,25,(50,)*3)draw_life(250,6,l)draw_bombe(30,-5)draw_string("x"+str(n__b)+"",56,2,(255,)*3,(50,)*3)defsortie(x,y):fill_rect(x-16,y-16,32,32,(50,)*3)vie=6n_b=0defjeu(carte,vie,n_b):carte_monstre=[1,2,3,4,5,5]x_s=304y_s=120fill_rect(0,0,320,222,(255,235,150))v_,d_,x_,y_,n,a,fin=4,1,0,30,1,0,Truex_crabe=[randint(1,9)*32,randint(1,9)*32,randint(1,9)*32,randint(1,9)*32,randint(1,9)*32]y_crabe=[randint(1,6)*32,randint(1,6)*32,randint(1,6)*32,randint(1,6)*32,randint(1,6)*32]d_crabe=[(randint(0,8)*2)+1,(randint(0,8)*2)+1,(randint(0,8)*2)+1,(randint(0,8)*2)+1,(randint(0,8)*2)+1]d_boulecrabe=[randint(1,4),randint(1,4),randint(1,4),randint(1,4),randint(1,4)]t_lance=[monotonic(),monotonic()-1,monotonic()-2,monotonic()-3,monotonic()-4]colors_crabe=[r,r,b,b,r]vitessecrabe=[4,4,8,8,4]aa=[1,0,1,0,0]n_crabe=carte_monstre[carte]x_bombe=-32y_bombe=-32x_boulecrabe=[500,500,500,500,500]y_boulecrabe=[500,500,500,500,500]t=[monotonic(),monotonic(),monotonic(),monotonic(),monotonic()]whilefin:#Move
ifkeydown(KEY_UP)andy_>30:y_-=v_;n=7+a;fill_rect(x_-5,y_-5,42,42,colors[0]);zelda(n,x_,y_)ifa==1:a=0else:a=1d_=1ifkeydown(KEY_DOWN)andy_<190:y_+=v_;n=1+a;fill_rect(x_-5,y_-5,42,42,colors[0]);zelda(n,x_,y_)ifa==1:a=0else:a=1d_=3ifkeydown(KEY_RIGHT)andx_<288:x_+=v_;n=10+a;fill_rect(x_-5,y_-5,42,42,colors[0]);zelda(n,x_,y_)ifa==1:a=0else:a=1d_=4ifkeydown(KEY_LEFT)andx_>0:x_-=v_;n=4+a;fill_rect(x_-5,y_-5,42,42,colors[0]);zelda(n,x_,y_)ifa==1:a=0else:a=1d_=2ifkeydown(KEY_OK):ifa==1:n+=2else:n+=1fill_rect(x_-18,y_-18,72,72,colors[0])zelda(n,x_,y_)foriinrange(0,n_crabe):ifx_+50>x_crabe[i]andx_<x_crabe[i]+50andy_+50>y_crabe[i]andy_<y_crabe[i]+50andvitessecrabe[i]==8andrandint(1,2)==1:draw_bombe(x_bombe,y_bombe);x_bombe=x_crabe[i];y_bombe=y_crabe[i]ifx_+50>x_crabe[i]andx_<x_crabe[i]+50andy_+50>y_crabe[i]andy_<y_crabe[i]+50:fill_rect(x_crabe[i]-vitessecrabe[i],y_crabe[i]-vitessecrabe[i],32+(2*vitessecrabe[i]),32+(2*vitessecrabe[i]),bg_color);fill_rect(x_crabe[i]+12,y_crabe[i],8,32,(255,)*3);fill_rect(x_crabe[i],y_crabe[i]+12,32,8,(255,)*3);sleep(0.1);fill_rect(x_crabe[i]-vitessecrabe[i],y_crabe[i]-vitessecrabe[i],32+(2*vitessecrabe[i]),32+(2*vitessecrabe[i]),bg_color);x_crabe[i],y_crabe[i]=5000,5000ifa==1:n-=2else:n-=1sleep(0.5)fill_rect(x_-18,y_-18,72,72,colors[0])zelda(n,x_,y_)ifkeydown(KEY_BACKSPACE)andn_b>0:fill_rect(0,25,320,222,bg_color)draw_bombe(x_,y_);n_b-=1sleep(1)foriinrange(3):foriinrange(0,6):fill_rect(0,25,320,222,(255-(i*25),)*3);zelda(n,x_,y_);sleep(0.1)foriinrange(0,5):x_boulecrabe[i]=5000;y_boulecrabe[i]=5000;x_crabe[i]=5000;y_crabe[i]=5000fill_rect(0,25,320,222,bg_color)zelda(n,x_,y_)#Crabes
foriinrange(0,n_crabe):fill_rect(x_crabe[i]-vitessecrabe[i],y_crabe[i]-vitessecrabe[i],32+(2*vitessecrabe[i]),32+(2*vitessecrabe[i]),bg_color)crabe(d_crabe[i]+aa[i],x_crabe[i],y_crabe[i],colors_crabe[i])ifmonotonic()-t[i]>1:d_crabe[i]=(randint(1,4)*2)-1;t[i]=monotonic()ifd_crabe[i]==1:y_crabe[i]+=vitessecrabe[i]ifd_crabe[i]==3:x_crabe[i]-=vitessecrabe[i]ifd_crabe[i]==5:y_crabe[i]-=vitessecrabe[i]ifd_crabe[i]==7:x_crabe[i]+=vitessecrabe[i]ifaa[i]==0:aa[i]=1else:aa[i]=0ifx_crabe[i]>288:x_crabe[i]-=vitessecrabe[i]ifx_crabe[i]<0:x_crabe[i]+=vitessecrabe[i]ify_crabe[i]>190:y_crabe[i]-=vitessecrabe[i]ify_crabe[i]<30:y_crabe[i]+=vitessecrabe[i]ifmonotonic()-t_lance[i]>6andaa[i]==0:fill_rect(x_boulecrabe[i],y_boulecrabe[i],32,32,bg_color);x_boulecrabe[i],y_boulecrabe[i]=x_crabe[i],y_crabe[i];t_lance[i]=monotonic()ifd_crabe[i]==1:d_boulecrabe[i]=1;y_boulecrabe[i]+=32ifd_crabe[i]==3:d_boulecrabe[i]=2;x_boulecrabe[i]-=32ifd_crabe[i]==5:d_boulecrabe[i]=3;y_boulecrabe[i]-=32ifd_crabe[i]==7:d_boulecrabe[i]=4;x_boulecrabe[i]+=32boulecrabe(x_boulecrabe[i],y_boulecrabe[i]);sleep(0.1)ifd_boulecrabe[i]==1:y_boulecrabe[i]+=vitessecrabe[i]ifd_boulecrabe[i]==2:x_boulecrabe[i]-=vitessecrabe[i]ifd_boulecrabe[i]==3:y_boulecrabe[i]-=vitessecrabe[i]ifd_boulecrabe[i]==4:x_boulecrabe[i]+=vitessecrabe[i]boulecrabe(x_boulecrabe[i],y_boulecrabe[i])ifx_+30>x_crabe[i]andx_<x_crabe[i]+30andy_+30>y_crabe[i]andy_<y_crabe[i]+30:vie-=1fill_rect(x_,y_,32,32,bg_color)ifd_==1:y_+=32ifd_==2:x_-=32ifd_==3:y_+=32ifd_==4:x_-=32zelda(n,x_,y_)elifx_+20>x_boulecrabe[i]andx_<x_boulecrabe[i]+20andy_+20>y_boulecrabe[i]andy_<y_boulecrabe[i]+20:vie-=1;fill_rect(x_boulecrabe[i],y_boulecrabe[i],32,32,bg_color);x_boulecrabe[i]=500;y_boulecrabe[i]=500fill_rect(x_,y_,32,32,bg_color)ifd_==1:y_+=32ifd_==2:x_-=32ifd_==3:y_+=32ifd_==4:x_-=32zelda(n,x_,y_)ifx_+20>x_bombeandx_<x_bombe+20andy_+20>y_bombeandy_<y_bombe+20:n_b+=1;fill_rect(x_bombe,y_bombe,32,32,bg_color);x_bombe=-32;y_bombe=-32draw_bombe(x_bombe,y_bombe)ifvie==0:perdu(x_,y_);vie-=1;fin=False#
sortie(x_s,y_s);barre(vie,n_b);sleep(0.001)ifx_+32>x_sandx_<x_sandy_+32>y_bombeandy_<y_s:carte+=1;fin=False;sortie_=1fill_rect(0,0,320,222,(0,)*3)ifcarte==6:draw_string("You Won!!",110,100);sleep(5)ifsortie_==1andcarte!=6:sortie_==0;jeu(carte,vie,n_b)jeu(0,vie,n_b)'''
##########THE LEGENDE OF ZELDA#############
Arrows for move and OK for attack
BACKSPACE for bombs
Create by MERLE
'''
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.