frommc1import*poseable="$!#%&'()+<=bm["farmlandignore="*.,/01"defallblocksticks(game,dt):...defAffChunk(g):setskycolor(g);setactualchunk(g);f(0,0,320,180,g.skycolor)forxinrange(16):foryinrange(9):afftex(x*20,y*20,g.actualchunk[x+y*16],game=g)classGame():def__init__(s):s.itemgeror=[]s.blocksavor={}s.leftuping=0s.rightuping=0s.center=0s.waterheight=60s.mobgeror=[]s.tools="?@ABDEFGIJKLNOPQSTUV"s.mapgenerator=""s.ispickacc="#459"s.cookable={"5":"-"}s.fuels={"'",1.5}s.foodeurs={("3",5,6)}s.stackdata={"@":1}s.blocksbreakstime={"$":0.9,"!":0.75,"#":7.5,"%":0.75,"&":0.6,"'":3,"(":3,")":3.75,"+":0.9,",":-1,"-":-1,".":0.1,"/":0.1,"0":0.1,"1":0.1,"2":-1,"3":-1,"4":15,"5":15,"9":15,":":4,";":4,"<":4,"=":4}s.traversable="m*.,/01bcl"s.invcaseposition=[]forxinrange(6):s.invcaseposition.append((50+26*x,195))forxinrange(6):s.invcaseposition.append((50+26*x,126))forxinrange(6):s.invcaseposition.append((50+26*x,100))s.invcaseposition.append((100,40))s.invcaseposition.append((126,40))s.invcaseposition.append((100,66))s.invcaseposition.append((126,66))s.invcaseposition.append((180,53))foryinrange(3):forxinrange(3):s.invcaseposition.append((74+x*26,14+y*26))s.invcaseposition.append((180,40))s.invcaseposition.append((100,0))s.invcaseposition.append((100,40))s.invcaseposition.append((180,40))s.invcaseposition.append((10,113))s.ticky=0s.tickmul=9s.player=Player(s)hotbarprint(s.player)s.chunklist={}s.actualchunk=Nones.actualchunkticker=[0forxinrange(144)]s.gametime=150s.skycolor=color(0,255,255)s.mobgeror.append(mob(s,posx=50,posy=100,typ=1,dim=1))s.genportal=[]AffChunk(s)s.dt=0while1:#debug(len(s.chunklist))
s.Timerinit=monotonic()s.player.update(s.dt,s)s.ticky+=1ifs.ticky==9:s.ticky=0ifs.player.inInv==0:formobsins.mobgeror:mobs.update(s)foriteins.itemgeror:ite.update(s)updatefoodsprite(s.player)updatelifesprite(s.player)s.dt=(monotonic()-s.Timerinit)ifs.dt!=0:draw_string(str(1/s.dt),200,0)s.gametime+=s.dtifs.gametime>300:s.gametime-=300defsetskycolor(s):tep=abs(s.gametime-150)*1.6ifs.player.dimension==0:s.skycolor=color(0,255-tep,255-tep)ifs.player.dimension==1:s.skycolor=color(217,23,19)defBlockSelectorUpdate(player):ifplayer.inInv:returnposx=int(player.Px/20)posy=int(player.Py/20)onrefresh=Falsetemp={42:(-1,1,7),43:(0,1,6),44:(1,1,5),36:(-1,0,0),38:(1,0,4),30:(-1,-1,1),31:(0,-1,2),32:(1,-1,3)}foreleintemp.keys():ifkeydown(ele):player.BlX=posx+temp[ele][0]player.BlY=posy+temp[ele][1]player.Bloselectn=temp[ele][2]onrefresh=Truebreakifonrefresh:ifplayer.oldBlX!=player.BlXorplayer.oldBlY!=player.BlY:BlocKSelectRefresh(player)elifposx!=player.lsblxorposy!=player.lsbly:player.BlX=posx+player.Blolistpos[player.Bloselectn][0]player.BlY=posy-player.Blolistpos[player.Bloselectn][1]BlocKSelectRefresh(player)defAffminicraft(player):temp=player.parent.invcasepositionforxinrange(5):refreshcase(player.parent,18+x)bx=temp[22][0]-25by=temp[22][1]+10f(bx,by,15,6,"gray")forxinrange(6):f(bx+20-x,by+x+4,1,-2*(x+1),"gray")defopeninterface(s):AffTotalInv(s)ifs.inInv==1:Affminicraft(s)ifs.inInv==2:AffBigCraft(s)ifs.inInv==3:AffFurnace(s)defAffTotalInv(player):ifplayer.inInv:f(0,0,320,180,"red")temp=player.parent.invcasepositionforxinrange(6,18):refreshcase(player.parent,x)refreshcase(player.parent,36)else:player.invcase=0player.oldinvcase=0AffChunk(player.parent)classPlayer():def__init__(s,par):s.onrightclick=Falses.rsrightclick=Trues.parent=pars.mov=0s.dimension=0s.olddimension=0s.destimer=0s.blocktodestime=-1s.breakoldtex=-1s.Bloselectn=0s.Blolistpos=((-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1))s.lsblx=-5s.lsbly=-5s.BlX=1s.BlY=0s.oldBlX=-1s.oldBlY=0s.rsenter=Falses.inInv=0s.inventory=["*"forxinrange(38)]s.invnumbers=[0forxinrange(38)]s.invdata=[0forxinrange(38)]s.inventory[0]="?"s.inventory[1]="@"s.inventory[2]="A"s.inventory[3]="B"s.inventory[4]=")"s.inventory[5]="m"foradinrange(38):ifs.inventory[ad]!="*":s.invnumbers[ad]=2ifs.inventory[ad]inpar.tools:s.invdata[ad]=100s.invcase=0s.oldinvcase=0s.oldfood=0s.oldlife=0s.saturation=0s.life=6s.food=20f(0,180,320,45,color(188,188,188))s.Chx=0s.Chy=8s.oldChx=s.Chxs.oldChy=s.Chys.Px=130s.Py=40s.lPx=130s.lPy=40s.speedy=0s.chunkload=Falses.speedx=0s.speedmax=115s.jumpforce=4s.keyindex=list(range(24,30))s.keyindex+=list(range(18,24))s.keyindex+=list(range(12,18))s.keyindex=tuple(s.keyindex)s.prerangedihuit=set(range(18))s.collx=10s.colly=20s.onground=Trues.onmoveitem=Falses.rsmoveitem=Trues.lastmaxheight=400s.spawnx=5s.spawny=59defcheckInputs(s):ifs.inInv==0:ifkeydown(50):s.inInv=1openinterface(s)else:ifkeydown(49):foreleinlist(range(18,22))+list(range(23,32)):addinventory(s,s.inventory[ele],s.invnumbers[ele])useitem(s,ele,s.invnumbers[ele])hotbarrefresh(s)s.inInv=0s.oldinvcase=1ifs.invcase<6:s.oldinvcase=s.invcases.invcase=0AffChunk(s.parent)BlocKSelectRefresh(s)s.onrightclick=Falsehotbarrefresh(s)interfaceupdate(s)defupdate(s,dt,parent):s.checkInputs()ifs.inInv:returnifint((s.Py+20)/20)<9:temp=getblock(int((s.Px+5)/20),int((s.Py+10)/20),parent)iftemp=="b":s.lastmaxheight=s.Pyiftemp=="m":s.dimension=1ifs.dimension==0else0parent.genportal.append((s.dimension,int(s.Px/20)-1,int(s.Py/20)-1,s.Chx,s.Chy))AffChunk(parent)iftemp=="l":s.dimension=2ifs.dimension==0else0AffChunk(parent)ifs.life<20ands.food>14:s.saturation+=dtifs.saturation>2:changelife(s,1)changefood(s,-1)s.saturation=0ifs.life==0:s.Chx=s.spawnx//14s.Px=20*(s.spawnx-abs(s.Chx*14))s.Chy=s.spawny//7s.Py=20*(s.spawny-abs(s.Chy*7))s.lPx=s.Pxs.lPy=s.Pys.life=20s.saturation=20s.food=0s.dimension=0AffChunk(s.parent)returnifs.rsrightclickandnotkeydown(KEY_ANS):s.rsrightclick=Falseifnots.rsrightclickandkeydown(KEY_ANS):s.onrightclick=Trues.rsrightclick=Trueallblocksticks(parent,dt)s.mov=0BlockSelectorUpdate(s)ifkeydown(KEY_LEFT):s.mov=2s.speedx=-s.speedmaxifkeydown(KEY_RIGHT):s.mov=1s.speedx=s.speedmaxifkeydown(KEY_UP)ands.onground:#refaire, risque de double saut
s.onground=Falses.speedy=s.jumpforces.torefresh=Trueifs.onrightclick==True:changelife(s,-1)s.onrightclick=Falseforeleinparent.foodeurs:ifele[0]==s.inventory[s.invcase]:useitem(s,s.invcase,1)refreshcase(parent,s.invcase)s.food+=ele[1]ifs.food>20:s.food=20returnifs.inventory[s.invcase]inposeable:test=int(s.Py/20)-s.Blolistpos[s.Bloselectn][1]havepos=0iftest<9:havepos=updatebloc(parent,int(s.Px/20)+s.Blolistpos[s.Bloselectn][0],test,s.inventory[s.invcase],False)ifhavepos:useitem(s,s.invcase,1)refreshcase(s.parent,s.invcase)b="black"f(s.BlX*20,s.BlY*20,20,1,b)f(s.BlX*20,s.BlY*20+19,20,1,b)f(s.BlX*20,s.BlY*20,1,20,b)f(s.BlX*20+19,s.BlY*20,1,20,b)else:blx=int(s.Px/20)+s.Blolistpos[s.Bloselectn][0]bly=int(s.Py/20)-s.Blolistpos[s.Bloselectn][1]hoverblock=getblock(blx,bly,s.parent)temp=s.parent.invcasepositionifhoverblock=="+"ands.inventory[s.invcase]=="-":if0<=int(s.Py/20)-1-s.Blolistpos[s.Bloselectn][1]:ifgetblock(int(s.Px/20)+s.Blolistpos[s.Bloselectn][0],int(s.Py/20)-s.Blolistpos[s.Bloselectn][1]-1,s.parent)=="*":useitem(s,s.invcase,1)refreshcase(s.parent,s.invcase)updatebloc(s.parent,int(s.Px/20)+s.Blolistpos[s.Bloselectn][0],int(s.Py/20)-1-s.Blolistpos[s.Bloselectn][1],".",True)ifhoverblock==")":s.inInv=2openinterface(s)ifhoverblockin{"<","="}:s.inInv=3openinterface(s)ifhoverblock=="k":ifs.inventory[s.invcase]=="}":bx=-1ifgetblock(blx+2,bly,s.parent)==getblock(blx+2,bly,s.parent)=="k":bx=1updatebloc(parent,blx+bx,bly,"l",True)useitem(s,s.invcase,1)refreshcase(s.parent,s.invcase)ifhoverblock=="*":ifs.inventory[s.invcase]=="]":ifgetblock(blx+1,bly,s.parent)==getblock(blx-1,bly,s.parent)=="[":updatebloc(parent,blx,bly,"m",False)ifkeydown(KEY_EXE):curx=int(s.Px/20)+s.Blolistpos[s.Bloselectn][0]cury=int(s.Py/20)-s.Blolistpos[s.Bloselectn][1]ifcury<9:tempbl=getblock(curx,cury,s.parent)iftempblinparent.blocksbreakstime.keys():s.blocktodestime=getdestime(parent,tempbl,s.invcase)breaktexture(0,curx,cury)else:s.blocktodestime=2000iftempblinparent.traversable:formobsoinparent.mobgeror:ifs.Chx==mobso.Chxands.Chy==mobso.Chy:mobx=int(mobso.Px/20)moby=int(mobso.Py/20)ifcurx==mobxandcury==moby:mobso.life-=1else:s.blocktodestime=2000s.destimer+=dt*(1+100*keydown(KEY_DIVISION))rat=s.destimer//(s.blocktodestime/5)ifrat!=s.breakoldtex:s.breakoldtex=ratifcury<9:breaktexture(int(rat),curx,cury)ifs.blocktodestime<s.destimer:s.breakoldtex=-1s.blocktodestime=-1tempo=updatebloc(parent,int(s.Px/20)+s.Blolistpos[s.Bloselectn][0],int(s.Py/20)-s.Blolistpos[s.Bloselectn][1],"*",True)iftempo!="*":ifs.inventory[s.invcase]ins.parent.tools:s.invdata[s.invcase]-=durato(s.parent,s.invcase)ifs.invdata[s.invcase]<=0:s.inventory[s.invcase]="*"refreshcase(s.parent,s.invcase)refreshcase(s.parent,s.invcase)tempo=list(tempo)gen=blocksdrops()forxinrange(3):tempdrop=next(gen)iftempdrop[0]==tempo[0]:tempo=getdrop(tempdrop[1])breakforeleintempo:places=addinventory(s,ele,1)ifplaces!="Nope":foraloinplaces:ifalo<6:refreshcase(s.parent,alo)f(s.BlX*20,s.BlY*20,20,1,"black")f(s.BlX*20,s.BlY*20+19,20,1,"black")f(s.BlX*20,s.BlY*20,1,20,"black")f(s.BlX*20+19,s.BlY*20,1,20,"black")s.destimer=0ifs.Px>300:s.Px=20s.Chx+=1s.chunkload=1ifs.Px<20:s.Px=290s.Chx-=1s.chunkload=1ifs.Py<20:s.Py=140s.Chy+=1s.chunkload=1s.lastmaxheight+=180ifs.Py>160:s.Py=20s.Chy-=1s.chunkload=1s.lastmaxheight-=180ifs.inInv==0:refresh(s,zombie=False)ifs.chunkload:AffChunk(s.parent)s.chunkload=0physicupdate(s,dt,parent)Game()
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.