from math import * from kandinsky import * from random import * from ion import * from time import * bg_color=(255,235,150) colors=[bg_color,(255,225,150),(100,100,50),(255,210,0),(100,225,100),(150,)*3] _down1=[ 0,0,0,0,0,4,4,4,4,4,4,0,0,0,0, 0,0,0,0,4,4,4,4,4,4,4,4,0,0,0, 0,0,1,0,4,2,2,2,2,2,2,4,0,1,0, 0,0,1,0,2,2,2,2,2,2,2,2,0,1,0, 0,0,1,1,2,1,4,1,1,4,1,2,1,1,0, 0,0,1,1,2,1,2,1,1,2,1,1,1,1,0, 0,0,0,1,1,1,1,1,1,1,1,1,1,2,0, 0,0,0,4,4,1,1,2,2,1,1,4,4,2,0, 0,2,2,2,2,2,1,1,1,1,4,4,2,2,2, 2,2,3,2,2,2,2,4,4,4,4,4,1,2,2, 2,3,3,3,2,2,3,2,2,4,4,1,1,1,2, 2,2,3,2,2,2,3,4,2,2,2,2,1,1,1, 2,2,3,2,2,2,3,2,2,4,4,4,4,1,0, 2,2,2,2,2,2,3,4,4,4,4,4,0,0,0, 0,3,3,3,3,3,2,0,0,2,2,2,0,0,0, 0,0,0,0,2,2,2,0,0,0,0,0,0,0,0] _down2=[ 0,0,0,0,0,4,4,4,4,4,4,0,0,0,0, 0,0,0,0,4,4,4,4,4,4,4,4,0,0,0, 0,0,1,0,4,2,2,2,2,2,2,4,0,1,0, 0,0,1,0,2,2,2,2,2,2,2,2,0,1,0, 0,0,1,1,2,1,4,1,1,4,1,2,1,1,0, 0,0,1,1,2,1,2,1,1,2,1,1,1,1,0, 0,0,0,1,1,1,1,1,1,1,1,1,1,2,0, 0,0,0,4,4,1,1,2,2,1,1,4,4,2,0, 0,2,2,2,2,2,1,1,1,1,4,4,2,2,2, 2,2,3,2,2,2,2,4,4,4,4,4,1,2,2, 2,3,3,3,2,2,3,2,2,4,4,1,1,1,2, 2,2,3,2,2,2,3,4,2,2,2,2,1,1,1, 2,2,3,2,2,2,3,2,2,4,4,4,4,1,0, 2,2,2,2,2,2,3,4,4,4,4,2,0,0,0, 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2,0,0,2,2,2,2,0,0,0, 0,0,0,0,0,0,0,0,0,2,2,0,0,0,0] _epee_up=[ 0,0,0,0,0,0,2,0,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,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] def draw_zelda(list,x,y): x1=x; y1=y for i in list: if i!=0: fill_rect(x1,y1,2,2,colors[i]) x1+=2 if x1>x+28: y1+=2; x1-=30 def draw_zelda_eppee3(list,x,y): y-=18; x1=x; y1=y for i in list: if i!=0: fill_rect(x1,y1,2,2,colors[i]) x1+=2 if x1>x+28: y1+=2; x1-=30 def draw_zelda_eppee(list,x,y): x-=18; x1=x; y1=y for i in list: if i!=0: fill_rect(x1,y1,2,2,colors[i]) x1+=2 if x1>x+46: y1+=2; x1-=48 def draw_zelda2(list,x,y): x+=28; x1=x; y1=y for i in list: if i!=0: fill_rect(x1,y1,2,2,colors[i]) x1-=2 if x1<x-28: y1+=2; x1+=30 def draw_zelda_eppee2(list,x,y): x+=48; x1=x; y1=y for i in list: if i!=0: fill_rect(x1,y1,2,2,colors[i]) x1-=2 if x1<x-46: y1+=2; x1+=48 def zelda(n,x,y): if n==1:draw_zelda(_down1,x,y) if n==2:draw_zelda(_down2,x,y) if n==3:draw_zelda(_epee_down,x,y) if n==4:draw_zelda(_left1,x,y) if n==5:draw_zelda(_left2,x,y) if n==6:draw_zelda_eppee(_epee_left,x,y) if n==7:draw_zelda(_up,x,y) if n==8:draw_zelda2(_up,x,y) if n==9:draw_zelda_eppee3(_epee_up,x,y) if n==10:draw_zelda2(_left1,x,y) if n==11:draw_zelda2(_left2,x,y) if n==12:draw_zelda_eppee2(_epee_left,x,y) def perdu(x,y): r=0 v=0 b=0 for j in range(5): for i in range(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+=7 fill_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] def draw_crabe_up(list1,list2,x,y): x1=x; y1=y for i in list1: if i!=0: fill_rect(x1,y1,2,2,list2[i]) x1+=2 if x1>x+30: y1+=2; x1=x def draw_crabe_left(list1,list2,x,y): x1=x; y1=y for i in list1: if i!=0: fill_rect(x1,y1,2,2,list2[i]) y1+=2 if y1>y+30: x1+=2; y1=y def draw_crabe_down(list1,list2,x,y): x1=x; y1=y+30 for i in list1: if i!=0: fill_rect(x1,y1,2,2,list2[i]) x1+=2 if x1>x+30: y1-=2; x1=x def draw_crabe_right(list1,list2,x,y): x1=x+30; y1=y for i in list1: if i!=0: fill_rect(x1,y1,2,2,list2[i]) y1+=2 if y1>y+30: x1-=2; y1=y def crabe(n,x,y,c): if n==1:draw_crabe_down(crabe1,c,x,y) if n==2:draw_crabe_down(crabe2,c,x,y) if n==3:draw_crabe_left(crabe1,c,x,y) if n==4:draw_crabe_left(crabe2,c,x,y) if n==5:draw_crabe_up(crabe1,c,x,y) if n==6:draw_crabe_up(crabe2,c,x,y) if n==7:draw_crabe_right(crabe1,c,x,y) if n==8:draw_crabe_right(crabe2,c,x,y) def boulecrabe(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] def draw_life(x,y,l): x1=x; y1=y for i in _life: if i==0:fill_rect(x1,y1,2,2,(50,50,50)) if i<=l and i!=0:fill_rect(x1,y1,2,2,(255,0,0)) elif i>l:fill_rect(x1,y1,2,2,(150,0,0)) x1+=2 if x1>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] def draw_bombe(x,y): x1=x+8; y1=y+8 for i in bombe: if i!=0: fill_rect(x1,y1,1,1,_bombe[i]) x1+=1 if x1>x+23:y1+=1;x1=x+8 def barre(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) def sortie(x,y): fill_rect(x-16,y-16,32,32,(50,)*3) vie=6 n_b=0 def jeu(carte,vie,n_b): carte_monstre=[1,2,3,4,5,5] x_s=304 y_s=120 fill_rect(0,0,320,222,(255,235,150)) v_,d_,x_,y_,n,a,fin=4,1,0,30,1,0,True x_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=-32 y_bombe=-32 x_boulecrabe=[500,500,500,500,500] y_boulecrabe=[500,500,500,500,500] t=[monotonic(),monotonic(),monotonic(),monotonic(),monotonic()] while fin: #Move if keydown(KEY_UP) and y_>30: y_-=v_;n=7+a;fill_rect(x_-5,y_-5,42,42,colors[0]);zelda(n,x_,y_) if a==1:a=0 else:a=1 d_=1 if keydown(KEY_DOWN) and y_<190: y_+=v_;n=1+a;fill_rect(x_-5,y_-5,42,42,colors[0]);zelda(n,x_,y_) if a==1:a=0 else:a=1 d_=3 if keydown(KEY_RIGHT) and x_<288: x_+=v_;n=10+a;fill_rect(x_-5,y_-5,42,42,colors[0]);zelda(n,x_,y_) if a==1:a=0 else:a=1 d_=4 if keydown(KEY_LEFT) and x_>0: x_-=v_;n=4+a;fill_rect(x_-5,y_-5,42,42,colors[0]);zelda(n,x_,y_) if a==1:a=0 else:a=1 d_=2 if keydown(KEY_OK): if a==1:n+=2 else:n+=1 fill_rect(x_-18,y_-18,72,72,colors[0]) zelda(n,x_,y_) for i in range(0,n_crabe): if x_+50>x_crabe[i] and x_<x_crabe[i]+50 and y_+50>y_crabe[i] and y_<y_crabe[i]+50 and vitessecrabe[i]==8 and randint(1,2)==1:draw_bombe(x_bombe,y_bombe);x_bombe=x_crabe[i];y_bombe=y_crabe[i] if x_+50>x_crabe[i] and x_<x_crabe[i]+50 and y_+50>y_crabe[i] and y_<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,5000 if a==1:n-=2 else:n-=1 sleep(0.5) fill_rect(x_-18,y_-18,72,72,colors[0]) zelda(n,x_,y_) if keydown(KEY_BACKSPACE) and n_b>0: fill_rect(0,25,320,222,bg_color) draw_bombe(x_,y_);n_b-=1 sleep(1) for i in range(3): for i in range(0,6):fill_rect(0,25,320,222,(255-(i*25),)*3);zelda(n,x_,y_);sleep(0.1) for i in range(0,5):x_boulecrabe[i]=5000;y_boulecrabe[i]=5000;x_crabe[i]=5000;y_crabe[i]=5000 fill_rect(0,25,320,222,bg_color) zelda(n,x_,y_) #Crabes for i in range(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]) if monotonic()-t[i]>1:d_crabe[i]=(randint(1,4)*2)-1;t[i]=monotonic() if d_crabe[i]==1:y_crabe[i]+=vitessecrabe[i] if d_crabe[i]==3:x_crabe[i]-=vitessecrabe[i] if d_crabe[i]==5:y_crabe[i]-=vitessecrabe[i] if d_crabe[i]==7:x_crabe[i]+=vitessecrabe[i] if aa[i]==0:aa[i]=1 else:aa[i]=0 if x_crabe[i]>288:x_crabe[i]-=vitessecrabe[i] if x_crabe[i]<0:x_crabe[i]+=vitessecrabe[i] if y_crabe[i]>190:y_crabe[i]-=vitessecrabe[i] if y_crabe[i]<30:y_crabe[i]+=vitessecrabe[i] if monotonic()-t_lance[i]>6 and aa[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() if d_crabe[i]==1:d_boulecrabe[i]=1;y_boulecrabe[i]+=32 if d_crabe[i]==3:d_boulecrabe[i]=2;x_boulecrabe[i]-=32 if d_crabe[i]==5:d_boulecrabe[i]=3;y_boulecrabe[i]-=32 if d_crabe[i]==7:d_boulecrabe[i]=4;x_boulecrabe[i]+=32 boulecrabe(x_boulecrabe[i],y_boulecrabe[i]);sleep(0.1) if d_boulecrabe[i]==1:y_boulecrabe[i]+=vitessecrabe[i] if d_boulecrabe[i]==2:x_boulecrabe[i]-=vitessecrabe[i] if d_boulecrabe[i]==3:y_boulecrabe[i]-=vitessecrabe[i] if d_boulecrabe[i]==4:x_boulecrabe[i]+=vitessecrabe[i] boulecrabe(x_boulecrabe[i],y_boulecrabe[i]) if x_+30>x_crabe[i] and x_<x_crabe[i]+30 and y_+30>y_crabe[i] and y_<y_crabe[i]+30: vie-=1 fill_rect(x_,y_,32,32,bg_color) if d_==1:y_+=32 if d_==2:x_-=32 if d_==3:y_+=32 if d_==4:x_-=32 zelda(n,x_,y_) elif x_+20>x_boulecrabe[i] and x_<x_boulecrabe[i]+20 and y_+20>y_boulecrabe[i] and y_<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]=500 fill_rect(x_,y_,32,32,bg_color) if d_==1:y_+=32 if d_==2:x_-=32 if d_==3:y_+=32 if d_==4:x_-=32 zelda(n,x_,y_) if x_+20>x_bombe and x_<x_bombe+20 and y_+20>y_bombe and y_<y_bombe+20:n_b+=1;fill_rect(x_bombe,y_bombe,32,32,bg_color);x_bombe=-32;y_bombe=-32 draw_bombe(x_bombe,y_bombe) if vie==0:perdu(x_,y_);vie-=1;fin=False # sortie(x_s,y_s);barre(vie,n_b);sleep(0.001) if x_+32>x_s and x_<x_s and y_+32>y_bombe and y_<y_s:carte+=1;fin=False;sortie_=1 fill_rect(0,0,320,222,(0,)*3) if carte==6:draw_string("You Won!!",110,100);sleep(5) if sortie_==1 and carte!=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 '''