Created
July 9, 2022 12:21
-
-
Save TheBonnec/c9dfa46c30fdc50377ef0d84b24b06c9 to your computer and use it in GitHub Desktop.
DLA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from micropython import *;from math import *;from kandinsky import *;from os import *;from ion import *;from time import *;from random import *;from matplotlib.pyplot import * | |
kbd_intr(KEY_ZERO) | |
bg=255 | |
ccl={ | |
0:color(0,0,0), | |
1:color(160,50,50), | |
2:color(255,0,0), | |
3:color(0,0,255) | |
#4:color(jn1.bg,jn1.bg,jn1.bg) | |
} | |
fl=fill_rect;k=keydown;dr=draw_string | |
rk_beg=["Ranger ","Ecuyer ","Elite ","Vaillant ","Chevalier ","Seigneur ","Hero ","Champion ","Legende ","Saint ","Ange ","Seraphin ","Emissaire divin ","Revelation ","Divin ","Deite ","Dieu-Roi ","Demon Lord "] | |
r_rk=["Aventurier "] | |
for i in range(len(rk_beg)): | |
for j in range(5):r_rk.append(str(rk_beg[i]+str(j+1))) | |
def launch(): | |
file_list=listdir();r_fl=[] | |
for i in range(len(file_list)): | |
if "ds_" in file_list[i]:r_fl.append(file_list[i]); | |
r_fl.reverse();fl(0,0,333,333,ccl[0]);sleep(0.5);fl(100,50,100,10,ccl[2]);fl(100,50,10,100,ccl[2]);fl(100,100,100,10,ccl[2]);fl(100,150,100,10,ccl[2]);fl(140,50,10,100,ccl[2]);dr("+++ Ersatz d'Eratz studio +++",50,160,ccl[2],ccl[0],1);sleep(2) | |
def launch_redraw(y): | |
fl(0,0,330,222,ccl[1]);dr("+++ Demon Lord Academia +++",20,0,ccl[0],ccl[1]);dr("- shadow of bahamut -",80,20,ccl[0],ccl[1],1);y_c=80 | |
for i in range(len(r_fl)):dr(str(r_fl[i]),100,y_c,ccl[0],ccl[1],1);y_c+=20 | |
dr("nouveau jeu",100,int(y_c),ccl[0],ccl[1],1) | |
launch_redraw(80);y_c_=80;d=0;beg_l=True | |
while beg_l: | |
sleep(0.07);dr("> ",80,y_c_,ccl[0],ccl[1],1) | |
if k(KEY_UP) and y_c_!=80:y_c_-=20;launch_redraw(80);d-=1 | |
if k(KEY_DOWN) and y_c_!=80+len(r_fl)*20:y_c_+=20;launch_redraw(80);d+=1 | |
if k(KEY_OK): | |
if y_c_==80+len(r_fl)*20:jjj=str(input("nom du joueur : "));b_f=open("cc.py","a");b_f.write("jj_name= '"+str(jjj)+"'\nrnk= 0\nxps= 0\nxprs=10\nstt=[1,100,0,0,0,10]\nlenn=0\ns_nbz=3\n#");b_f.close();from cc import *;rename("cc.py","ds_"+str(jjj)+".txt");input("\n\n\n\n\n\n\n\n\timportant ! \ncontroles :\ntouche ok : selectionner \ntouche retour : retour\ntouche 0 : quitter le jeu\ntouce shift : pause \ntouches 7 a 9 : competences\n\n\nOK pour continuer");beg_l=False | |
else:rename(str(r_fl[d]),"cc.py");from cc import *;rename("cc.py",str(r_fl[d]));beg_l=False | |
quit=0 | |
respawn=0 | |
def end(): | |
dead=True | |
dd_d=1 | |
def end_redraw(y): | |
fl(0,0,333,222,ccl[1]);dr(" - GAME OVER - ",100,50,ccl[0],ccl[1]) | |
dr(" respawn ",80,100,ccl[0],ccl[1]) | |
dr(" quit ",80,120,ccl[0],ccl[1]) | |
dr("> ",60,y,ccl[0],ccl[1]) | |
end_redraw(100) | |
while dead: | |
if k(KEY_DOWN):end_redraw(120);dd_d=2 | |
if k(KEY_UP):end_redraw(100);dd_d=1 | |
if k(KEY_OK) and dd_d==1:respawn=1;print("to");dead=False | |
if k(KEY_OK) and dd_d==2:q=input("unlaunched");game_q() | |
sleep(0.07) | |
print("o") | |
launch() | |
l_mob=[] | |
def game_load(): | |
x_lg=20;fl(0,0,333,333,ccl[0]);fl(10,10,20,2,(255,0,0));fl(10,10,2,20,(255,0,0));fl(10,30,20,2,(255,0,0));fl(10,20,20,2,(255,0,0));fl(18,10,2,20,(255,0,0));dr("loading",210,175,(255,255,255),ccl[0],1);fl(200,190,x_lg,10,ccl[2]) | |
for i in range(80):l_mob.append("m"+str(i+1)) | |
while not x_lg>=100:fl(200,190,x_lg,10,ccl[2]);x_lg+=randint(1,5);sleep(0.07) | |
game_load() | |
facteur=1 | |
def spawner(nbz): | |
for i in range(nbz): | |
_a=randint(1,30)*10 | |
_b=randint(1,20)*10 | |
l_mob[i+1]=Mob(_a,_b,int(jn1.len_n+1*facteur),int(jn1.len_n+1)*facteur,1,5) | |
class Jn: | |
def __init__(self,bg,cjn,ci,len_n): | |
self.cjn=cjn | |
self.ci=ci | |
self.ta=0 | |
self.bg=bg | |
self.len_n=len_n | |
def cycle(self): | |
self.cjn+=1 | |
if self.ci==0 and self.cjn>50 and self.bg>0:self.bg-=1 | |
if self.bg==0:self.ci=1 | |
if self.ci==1:self.ta+=1 | |
if self.ta>50:self.bg+=1 | |
if self.ci==1 and self.bg==255: | |
self.ta=0;self.ci=0;self.cjn=0;self.len_n+=1 | |
jn1=Jn(255,0,0,lenn) | |
class Screen: | |
def __init__(self,pos,lx,ly): | |
self.pos=pos;self.lx=lx;self.ly=ly;self.oldpose=0;_e=0 | |
def rendu(self): | |
def coffre(x,y): | |
fl(x-1,y-1,12,12,ccl[0]);fl(x,y,10,10,'brown');fl(x,y+3,10,1,ccl[0]) | |
if k(KEY_OK) and j1.x==x and j1.y==y: | |
e_c=randint(1,50)*10;j1.pv[5]=j1.pv[5]+int(e_c);dr("vous gagnez "+str(e_c)+" pieces",60,50,ccl[2],ccl[0]);sleep(2) | |
self.oldpose=1 | |
def shop(): | |
fl(49,49,12,12,(0,0,0));fl(50,50,10,10,(255,255,0));fl(51,51,8,3,'brown');fl(52,51,6,8,'brown') | |
if k(KEY_OK) and j1.x==50 and j1.y==50: | |
def shop_r(): | |
fl(10,10,300,200,('brown'));dr(" - SHOP - | pieces : "+str(j1.pv[5])+" ",40,11,ccl[2],ccl[0]);dr(" acheter un p.u : -1000 ",60,50,ccl[2],ccl[0],1);dr(" vendre un p.u : +800 ",60,70,ccl[2],ccl[0],1);dr("acheter un xp : -1 ",60,90,ccl[2],ccl[0],1);dr(" vendre un xp : +1 ",60,110,ccl[2],ccl[0],1) | |
shop_r() | |
y__=50 | |
while not k(KEY_BACK): | |
dr(" > ",35,y__,ccl[2],ccl[0],1) | |
if k(KEY_DOWN) and y__!=110:y__+=20;shop_r() | |
if k(KEY_UP) and y__!=50:y__-=20;shop_r() | |
if k(KEY_OK): | |
if y__==50 and j1.pv[5]>=1000:j1.pv[5]-=1000;j1.pv[4]+=1 | |
if y__==70 and j1.pv[4]>=1:j1.pv[5]+=800;j1.pv[4]-=1 | |
if y__==90 and j1.pv[5]>=1:j1.pv[5]-=1;t1.xp+=1 | |
if y__==110 and t1.xp>=1:j1.pv[5]+=1;t1.xp-=1 | |
sleep(0.07) | |
def hasard_du_turfu_mon_gars(): | |
fl(149,49,12,12,ccl[0]);fl(150,50,10,10,(255,255,0));dr("?",150,50,ccl[2],(255,255,0),1) | |
if k(KEY_OK) and j1.x==150 and j1.y==50: | |
def random_r(): | |
fl(10,10,300,200,'brown') | |
dr(" welcome to le jeux de hasard ",10,11,ccl[2],ccl[0]) | |
dr(" miser ",50,50,ccl[2],ccl[0]) | |
dr(" cassos ",50,80,ccl[2],ccl[0]) | |
random_r() | |
__y=50 | |
has=True | |
sleep(0.5) | |
while has: | |
random_r() | |
dr(" > ",30,__y,ccl[2],ccl[0]) | |
if k(KEY_DOWN):__y=80;random_r() | |
if k(KEY_UP):__y=50;random_r() | |
if k(KEY_BACK):has=False | |
if k(KEY_OK): | |
if __y==80:has=False | |
if __y==50: | |
def mine_r(): | |
fl(10,10,300,200,"brown") | |
mine_r() | |
mise=True | |
mis=0 | |
sleep(0.5) | |
game_load() | |
jn1.len_n+=1 | |
while mise: | |
mine_r() | |
dr("miser <"+str(mis)+"> pieces",80,50,ccl[2],ccl[0]) | |
if k(KEY_RIGHT) and mis<j1.pv[5]:mis+=1 | |
if k(KEY_LEFT) and mis>0:mis-=1 | |
if k(KEY_BACK):mise=False | |
if k(KEY_OK): | |
def ok_r(): | |
fl(10,10,300,200,"brown");dr("choisissez un coffre !",50,11,ccl[2],ccl[0]);chest(40,100);chest(140,100);chest(240,100) | |
def chest(x,y): | |
fl(x-1,y-1,32,32,ccl[0]);fl(x,y,30,30,ccl[3]);fl(x,y+10,30,3,ccl[0]) | |
def win(): | |
for i in range(50): | |
c1=randint(1,255) | |
c2=randint(1,255) | |
c3=randint(1,255) | |
fl(0,0,333,333,(c1,c2,c3)) | |
dr(" ! WINNER ! ",100,50,ccl[2],ccl[0]);sleep(0.02) | |
ok_r() | |
y_k=50 | |
y_kk=1 | |
chee=True | |
chj=randint(1,3) | |
sleep(0.5) | |
while chee: | |
ok_r() | |
dr(" ^ ",y_k,140,ccl[2],ccl[0]) | |
if k(KEY_BACK):chee=False | |
if k(KEY_RIGHT) and y_k!=250:y_k+=100;y_kk+=1;ok_r() | |
if k(KEY_LEFT) and y_k!=50:y_k-=100;y_kk-=1;ok_r() | |
if k(KEY_OK): | |
if y_kk==chj: | |
win() | |
dr("vous avez gagnez "+str(mis)+" pieces",20,50,ccl[2],ccl[0]) | |
j1.pv[5]+=mis | |
sleep(2) | |
else: | |
dr("vous avez perdu "+str(int(mis*0.5))+" pieces",20,50,ccl[2],ccl[0]) | |
j1.pv[5]-=int(mis/2) | |
sleep(2) | |
chee=False | |
sleep(0.07) | |
sleep(0.07) | |
sleep(0.07) | |
def b_up():fl(0,0,320,20,ccl[3]) | |
def b_left():fl(0,0,20,222,ccl[3]) | |
def b_right():fl(300,0,20,220,ccl[3]) | |
def b_down():fl(0,200,320,22,ccl[3]) | |
def coin_eau(x,y):fl(x,y,20,20,ccl[3]) | |
def riviere():fl(130,0,40,222,ccl[3]) | |
def pont(x,y,d1,d2):fl(x,y,d1,d2,'brown') | |
def v1():b_left();b_up();b_down();b_right();pont(295,100,30,20);pont(140,195,20,30);shop();hasard_du_turfu_mon_gars() | |
def v2():b_left();b_up();b_down();b_right();pont(0,100,25,20);pont(140,0,20,25) | |
if self.pos==1:v1() | |
if self.pos==2:b_up();b_left();pont(0,100,25,20) | |
if self.pos==3:b_up() | |
if self.pos==4:b_up();riviere() | |
if self.pos==5:b_up() | |
if self.pos==6:b_up();b_right() | |
if self.pos==7:b_left();b_up();pont(140,0,20,25) | |
if self.pos==8:coin_eau(0,0) | |
if self.pos==9:pass | |
if self.pos==10:riviere() | |
if self.pos==11:pass | |
if self.pos==12:b_right() | |
if self.pos==13:b_left() | |
if self.pos==14:pass | |
if self.pos==15:pass | |
if self.pos==16:riviere() | |
if self.pos==17:pass | |
if self.pos==18:b_right() | |
if self.pos==19:b_left() | |
if self.pos==20:pass | |
if self.pos==21:pass | |
if self.pos==22: | |
riviere() | |
if rank>25: | |
pont(125,100,50,20) | |
if self.pos==23:pass | |
if self.pos==24:b_right() | |
if self.pos==25:b_left() | |
if self.pos==26:pass | |
if self.pos==27:pass | |
if self.pos==28:riviere() | |
if self.pos==29:coin_eau(300,200) | |
if self.pos==30:b_right();b_down();pont(140,195,20,25) | |
if self.pos==31:b_left();b_down() | |
if self.pos==32:b_down() | |
if self.pos==33:b_down() | |
if self.pos==34:b_down();riviere() | |
if self.pos==35:b_down();b_right();pont(295,100,25,20) | |
if self.pos==36:v2() | |
if self.oldpose==0: | |
chance=randint(1,50) | |
self.oldpose=1 | |
if chance==50: | |
self.oldpose=2 | |
if self.oldpose==2: | |
coffre(100,100) | |
class Joueur: | |
def __init__(self,x,y,d,pv,lr): | |
self.life_r=lr;self.x=x;self.y=y;self.d=d;self.pv=pv | |
def move(self): | |
if k(KEY_HOME):map(screen.lx,screen.ly) | |
if k(KEY_TOOLBOX):sac() | |
if k(KEY_OK) and t1.d==0:t1.d=1;t1.x=self.x;t1.y=self.y;t1.d1=self.d | |
if k(KEY_DOWN):self.y+=10;self.d=4 | |
elif k(KEY_UP):self.y-=10;self.d=3 | |
elif k(KEY_RIGHT):self.x+=10;self.d=1 | |
elif k(KEY_LEFT):self.x-=10;self.d=2 | |
if self.x>310 and screen.lx!=6:screen.pos+=1;screen.lx+=1;self.x=0;screen.oldpose=0 | |
if self.x<0 and screen.lx!=1:screen.pos-=1;screen.lx-=1;self.x=310;screen.oldpose=0 | |
if self.y>210 and screen.ly!=6:screen.pos+=6;screen.ly+=1;self.y=0;screen.oldpose=0 | |
if self.y<0 and screen.ly!=1:screen.pos-=6;screen.ly-=1;self.y=210;screen.oldpose=0 | |
if get_pixel(self.x,self.y)==color(0,0,255): | |
if self.d==1:self.x-=10 | |
if self.d==2:self.x+=10 | |
if self.d==3:self.y+=10 | |
if self.d==4:self.y-=10 | |
def rendu(self): | |
fl(2,2,int(self.pv[1]),10,ccl[2]);fl(self.x,self.y,10,10,ccl[2]) | |
def globall(self): | |
self.move();self.rendu() | |
class Mob: | |
def __init__(self,x,y,pv,deg,d,t): | |
self.x=x;self.y=y;self.pv=pv;self.deg=deg;self.t=t | |
def move(self): | |
if self.pv>0: | |
if self.t==0: | |
if self.x<j1.x:self.x+=10 | |
if self.x>j1.x:self.x-=10 | |
if self.y<j1.y:self.y+=10 | |
if self.y>j1.y:self.y-=10 | |
self.t=4 | |
if self.x==j1.x and self.y==j1.y: | |
j1.pv[1]-=self.deg | |
if self.t>0: | |
self.t-=1 | |
def rendu(self): | |
fl(self.x,self.y,10,10,(0,255,0)) | |
def globall(self): | |
if self.pv>0:self.move();self.rendu() | |
class Tir: | |
def __init__(self,x,y,deg,xp,d,d1): | |
self.d1=d1;self.d=d;self.x=x;self.y=y;self.deg=deg;self.xp=xp | |
def collid(self,coll): | |
if self.d==1: | |
if coll.pv>0 and self.x==coll.x and self.y==coll.y: | |
self.d=0;coll.pv-=j1.pv[0] | |
if coll.pv<=0: | |
self.xp+=int(jn1.len_n+1*facteur);j1.pv[5]+=int(jn1.len_n+1*facteur) | |
def move(self,coll): | |
if self.d==1: | |
for i in range(4): | |
if self.d==1: | |
if self.d1==1:self.x+=10 | |
if self.d1==2:self.x-=10 | |
if self.d1==3:self.y-=10 | |
if self.d1==4:self.y+=10 | |
if self.x<0 or self.x>310 or self.y<0 or self.y>210:self.d=0 | |
for i in range(nbzz): | |
try: | |
if coll[i+1].pv>0: | |
self.collid(l_mob[i+1]) | |
except AttributeError:pass | |
def rendu(self): | |
fl(self.x+2,self.y+2,6,6,(255,255,0)) | |
def globall(self,coll): | |
if self.d==1:self.move(coll);self.rendu() | |
def sac(): | |
x_rr=10 | |
def sac_r(x): | |
fl(10,10,300,20,ccl[0]);fl(10,30,300,180,'brown') | |
fl(x,10,100,20,'brown') | |
dr("statut",21,11,ccl[2],ccl[0],1);dr("upgrade",121,11,ccl[2],ccl[0],1);dr("save",221,11,ccl[2],ccl[0],1) | |
if x==210:dr("> sauvegarder <",80,50,(255,0,0),'brown') | |
if x==110:dr(" upgrade : "+str(j1.pv[4])+" ",80,40,ccl[2],ccl[0]);dr(" damage : "+str(j1.pv[0])+" ",30,60,ccl[2],ccl[0]);dr(" life : "+str(j1.life_r)+" ",30,80,ccl[2],ccl[0]);dr(" regen (pv/s) : "+str(j1.pv[2])+" ",30,100,ccl[2],ccl[0]);dr(" dash + : "+str(j1.pv[3])+" ",30,120,ccl[2],ccl[0]) | |
if x==10:dr(" "+str(jname)+" ",80,30,ccl[2],ccl[0],1);dr("| rank : "+str(r_rk[rank])+" |",30,50,ccl[2],ccl[0],1);dr(" puissance totale : "+str(int(j1.pv[0]*100+j1.pv[1]*10+j1.pv[2]*j1.pv[1]+j1.pv[3]*10))+" ",30,70,ccl[2],ccl[0],1);dr(" xp : "+str(t1.xp)+"/"+str(xprs)+" ",30,90,ccl[2],ccl[0],1);dr(" nuit "+str(jn1.len_n)+" ",150,90,ccl[2],ccl[0],1);dr(" HP : "+str(int(j1.pv[1]))+"/"+str(j1.life_r)+" ",30,110,ccl[2],ccl[0],1);dr(" pieces : "+str(j1.pv[5])+" ",140,110,ccl[2],ccl[0],1) | |
sac_r(x_rr) | |
saac=True | |
y_up=60 | |
while saac: | |
if k(KEY_OK) and x_rr==210:satp=[j1.pv[0],j1.life_r,j1.pv[2],j1.pv[3],j1.pv[4],j1.pv[5]];f_s=open("ds_"+str(jname)+".txt","w");f_s.write("jj_name= '"+str(jname)+"'\nrnk= "+str(rank)+"\nxps= "+str(t1.xp)+"\nxprs="+str(xprs)+"\nstt="+str(satp)+"\nlenn="+str(jn1.len_n)+"\ns_nbz="+str(nbzz)+"\n#");f_s.close();saac=False | |
if k(KEY_BACK):saac=False | |
if k(KEY_RIGHT) and x_rr!=210:x_rr+=100;sac_r(x_rr) | |
if k(KEY_LEFT) and x_rr!=10:x_rr-=100;sac_r(x_rr) | |
if x_rr==110: | |
dr("> ",20,y_up,ccl[2],ccl[0]) | |
if k(KEY_DOWN) and y_up!=120:y_up+=20;sac_r(x_rr) | |
if k(KEY_UP) and y_up!=60:y_up-=20;sac_r(x_rr) | |
if j1.pv[4]>=1: | |
if k(KEY_OK): | |
if y_up==60:j1.pv[4]-=1;j1.pv[0]+=1 | |
if y_up==80:j1.pv[4]-=1;j1.pv[1]+=10;j1.life_r+=10 | |
if y_up==100:j1.pv[4]-=1;j1.pv[2]+=0.5 | |
if y_up==120:j1.pv[4]-=1;j1.pv[3]+=1 | |
sac_r(x_rr) | |
sleep(0.07) | |
def map(x,y): | |
fl(0,0,333,333,'brown') | |
fl(10,5,300,210,(255,)*3) | |
for j in range(6): | |
for i in range(6): | |
fl(50*i+10,35*j+5,50,35,ccl[0]);fl(50*i+11,35*j+6,48,33,(255,)*3) | |
fl((x-1)*50+11,(y-1)*35+6,48,33,ccl[2]) | |
while not k(KEY_BACK): | |
pass | |
xp=xps;xpr=xprs;rank=rnk;nbzz=s_nbz;jname=j_name;j1=Joueur(100,100,1,stt,stt[1]);screen=Screen(1,1,1);m1=Mob(200,200,2,2,3,3);t1=Tir(j1.x,j1.y,1,xps,0,1);main=True | |
def mclear(): | |
for i in range(nbzz): | |
try:l_mob[i].pv=0 | |
except AttributeError:pass | |
#main | |
oldpos=1 | |
while main: | |
fl(0,0,333,222,(jn1.bg,jn1.bg,jn1.bg)) | |
if 1<screen.pos<36 and oldpos!=screen.pos:spawner(nbzz);oldpos=screen.pos | |
if screen.pos==1 or screen.pos==36: | |
try:mclear() | |
except AttributeError:pass | |
screen.rendu();j1.globall();t1.globall(l_mob) | |
try: | |
for i in range(nbzz): | |
l_mob[i+1].globall() | |
except AttributeError:pass | |
if t1.xp>=xpr and rank<90:t1.xp=0;xpr=int(xpr*1.1);rank+=1;j1.pv[4]+=1 | |
if t1.xp>=xpr and rank>90:t1.xp=0;xpr=int(xpr*1.1);j1.pv[4]+=1 | |
disp_mob=1 | |
if disp_mob==1: | |
try: | |
for i in range(nbzz):l_mob[i].globall() | |
except AttributeError:pass | |
if j1.pv[1]<=0: | |
end() | |
screen.pos=1;screen.lx=1;screen.ly=1;t1.xp=0;j1.pv[1]=j1.life_r;mclear();oldpos=1 | |
game_load() | |
sleep(0.03) | |
jn1.cycle() | |
if 3<jn1.len_n<40:nbzz=jn1.len_n | |
if jn1.ci==1:facteur=2 | |
else:facteur=1 | |
if j1.pv[2]>0 and j1.pv[1]<j1.life_r: | |
j1.pv[1]+=j1.pv[2]/5 | |
if j1.pv[1]>j1.life_r:j1.pv[1]=j1.life_r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment