`Ham}P}Lu4888quui4DY@]yLP<aLPy 02TvͫgE#2Tv2Tv~~PPPUUPPUPUPP  pppwwQUPPP    PQUQQPQPPPQ UUPUPPUUPPPUUPPPPPUUPPPUPUU_UU  ff``PUPUPPU [ U [UU U U PUUPUUPPPPPUUPUQPPPPPPUUQUQPQPQPQPQUPPUPQU"" """""""""""""""""" """""" """""""""""""""""" """"UUQUPPPf`QPUQPUUUUUUUUU_______`ff`f`UUQUQQ`fffff`ff`fff`ffQUUQUUQQUUUUUUUUUUUU_______PQUQfQPQPfPPQ````XXUUPUUUPUUUUUUUUUUUUUUUUPEDDDEDDDEDDDEDDDEDDDEDDDEDDDUUUUDDDTDDDTDDDTDDDTDDDTDDDTDDDTUUUU`ffffffffff`fff`PPUPQUQUQQQQUUQQUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUfU`PUfUUUfUPUUUUUUUUUPUUUPUUUUPUUUUUUUUUUUPPPPUUUUUUUUUUUUUUPUPPPPUUUUUUUUUUXXXXUPUUUUUUXXXXPUUV`U PUffUPPUUUPUUUPUUUUUPUU_   PPUUUUUUUUUUUUPUUUUUUUUUUUUUUUUUUPPUUUUUUUUUUUPPUPUUUUUPUPUUUUUUUUUUUUUUUPUUPUUU PUUfffVUUk[kUk[kkkffffffkkkfffk fk`ffkkkffffkkkfffffffkkffffk`ffkkkkkk`ff`f``k``k`fkUUUUUUUUUUUUPUUUUUUUUUUUPUUUPUUUUUUUUUPUUPUUUUUPUPUUUUUPUUUUPUUPUUUUUUPUUPUUUP__UUU_U_UUU_UU_UUUUUUUUUUU_U_U__U__UUUUUUeffUefUVUeUVUUUUUUUUUUUUUUUUU_UefVo_VUUe_UU_U_U___U_U_UUUUUUUUUUUPUUUUUUUUPUUUPPUUUUUUUUUUUUPUUUUUPUPPUUUUUUUUUUUUUUUPUUPUUUUUUUUUUUUUPUU PUUUZUU`P`[[[UUPUUUeUUUUff[[[UUUUkV [[ UU UUfffnVenVegvww~홙НVeffVeVeffVegvgvwwwwyyVefVeffgvwwy 虙eUU`[[[UUUUUUUUUUff[[[UUUU^__UUUU홙Нywwwwwwwwwwwpwwwpwwwwwwwwwyww fyfw~f~fwP___UUUUUUUUUUUUU___UUUU UU___UUUUUUUUUU___UUUU VPUffVPU`ffVPU`ffVPUff`UeYP ffeUPeY `ff`UeYP ff`U`Y PffVPUffPVU`ffVPU`ffUPUUUPUUUUUUUPUUUPUPUUUUUPUUUPUPUUUPUUUPUUUUUUUUUPUPUUUUUUPPUPUUUUPUPPUPUPUUUUUUPUUUPUUUUUUUPPPUUUPPUPUUPPUUUPPPUUUPPPUUUUPPUUPPUUUPPPUUUPUPPUUPPPUUUPPPUU```X`X````XXU``UUUPUP_PUffUVeePVPUPU`fUfeePVPUPUfUfeefVPUPU`ffUfeePVPUP`fPf`fVPUPf`fV`fUUUff``VVePfff``UV`UUff``VVeUUPff`VPUUUff`f`VVeUUV`U PUffV`U PU`ffV`U PU`ffV`UPUff`UXPUQffeUPXQ`ff`UXP Qff`UXPUQffV`PUPUffPVePU`ffPPV`UPU`ffUPUUUPUUUUUUUPUUUPUPUUUUUPUUUPUPUUUPUUUPUUUUUUUUUPUPUUUUUUPPUPUUUUPUPPUPUPUUUUUUPUUUPUUUUUUUXhXffaaUUffffXffaaUUffffXffaaUUffffXhXffaaUUffffhhhffaaVeffffhffaaVeffffhhhffaaVeffffhhhffaaVeffffhhhffaaVeffffhffaaUUffffhffaaUUffffhhhffaaUUffffUUUUUUUUXXXXXXXUUUU[UffUUUUQXhUXUffQaUUVfffVQPUUUUUUXXX[UUUUV[[[[UUUUUUUUUUUUXXXXXQUUUUUUUUhheffUUUUUUUUXXXXXfQUUUUPUUUXXXXUUUffPUUU[[[[UUUQ`ffffffffff`fff`QUUQUQ`ff`f`XUUXUXPUUUUUUUUUUPUUUP~> [>?####### >?H)&#LLLLL )=}#KKKKK*#  !KKK%#%< L  ' 8- &!"#"!'&K##&->$-'w-&!"# B TUV167vbf6767O $67167_,6767767D 67 ,67167 ,(67ðɓ67,(67٣'67333(6767C3C(67ðC67'C'(6767CED67,#,#,#$$,,#?89:(ɀ08#8&99%#%9?:#(1,:&&&8:8&#@AB;EDDE'+##&9;. !"ꔕ # 8!&:.# !"&"##.  9#*>?#>?%#>?8:.> ?.OO./ #E D./ #  #%0C1D987E@3C1C0[\D C3C61:6O9DBD67_ABCĖĖ676ٴ3671C3-73C6675D-8C1CC4676E4C@ABE673D554164CD1344C475C446733674554C4467CC67444C444676744444467674444446767444D4 $% % D6 6,cde hi 9C3stu xywEC jkff z{  PYXb`p  :   QYWbaqra>? >? >?>?bw>??KKK  +,.///////////////////////////r+,-///////////////////////////+,-/////////////////////////// ,**+,/////////////////////////>>>?>=>=>?????????????????????  ///////////////////////////*/////**/////*///////..///////A0234556677899::;;<<<<===>>>>??w678:;<<>>?????????????????????d;<>??:???????????????????????? ?889?6 65?????????????????????? ///////////////////// '#///////////////////////////@ 000000000000000000000000000000009:86432100??????????????????U @a@a@a@@@@@a`a@a@@@a@a@a@@@@@a@a@a@EgEgEgEEEEEgEgEgEEEgEeEgEEEEEgEgEgE''GGGG''GGGG''GGGG'GG'GG''GGGG''GGGG''GGGG'GG'GGN`jjghnhgghnh#C#C#C#C#C#C#C#C#C#C#C#C#C#D$D$D$D$D$D$D$D$D$D$ggggggggggggggggggggggf@@`@bp   @     ?PUUUUUUUUUUUUUP_`ffP_`fP_fP_`fP_aafP_PDDDDDDDDDDDDTPDDDDDDDDDDDDTf`PDDDDDDDDDDDDT`fffPDDDDDDDDDDDDT`ffffPDDDDDDDDDDDDT`fffPDDDDDDDDDDDDTfffPDDDDDDDDDDDDT`faafPUUUUUUUUUUUUUffaafPQU``f`fPffff`PP`fff````aaf```````````ff````````````````````UUUU`fffff```U`UUUU```fVUUUUUf`PPQ`VVUUUUUUUUUUUUeQQUQQUQQPQUUUUUUUUUUUU`UUUUU``P```ffUUUUUUUUUUUU`f``h`ffff``ff``f`f````UUUUUUUUUUU``````PUUUPUUUPUUUUUUUU```eeeUUUUUUUUUUUUUUUUUUUUff`ffPUUUUUUUUUUUU`h``QffQffQffQf``ffQQQQ``QQQQUUUUUUUUUUUUUUUUUUUUf``ffUUUUUUUUUUUUUUaaf`ffeeeeeeeeeaV`Q`UUUUUUUUUUUUUUUUQUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU`QffQffQffQffQ`QQQQQQQQQQPUUUPUUUPUUUPUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU````````````````````````````"-- title: Dragon Fighter Alpha -- author: Anashex Games -- desc: Esta es la historia de Mikira, la demonio mas poderosa de toda el universo, pero ella no lo sabe... -- script: lua sqrt=math.sqrt sin=math.sin cos=math.cos rnd=math.random tan=math.tan rad=math.rad min=math.min max=math.max abs=math.abs del=table.remove music(1) --width, height w,h=240,136 --half-width and half-height hw,hh=w/2,h/2 --level/progress debug=false if debug then pmem(0,1) end fset(5,0,true) fset(5,4,false) floor=1 if pmem(0)==0 then pmem(0,1) end keys=pmem(10) floor=pmem(0) locks={} locks[1]={k={x=56,y=106},r={x=37,y=103}} locks[2]={k={x=15,y=61},r={x=17,y=54}} locks[3]={k={x=69,y=43},r={x=79,y=45}} gd_checks={} gd_checks[1]={x=15,y=10} gd_checks[2]={x=22,y=8} gd_checks[3]={x=36,y=11} gd_checks[4]={x=19,y=108} gd_checks[5]={x=47,y=107} --player and all its variables p={x=hw,y=hh,idx=256,type="player", vx=0,vy=0,mv=.1,mvup=-2, frm=0,flp=0,w=7,h=7,attack={id=1,idx=288, frm=0, state=false}, vit=100,frz=1,rst=20,death=false, win=false, bar={x=2,y=3,vit=25,w=3,col=4,had=25}, hado=100, darkHado=false, kunais=7,keys=keys} --the cats list and all their variables cats={} cats[1]={x=hw,y=hh,idx=275, vx=0,vy=0,mv=.08,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,death=false} --the dust list for managing --the particles dust={} --kunais kunais={} --the enemys mobs={} mobs[1]={type=1, x=hw,y=10,idx=304, vx=0,vy=0,mv=.15,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[2]={type=1, x=223,y=72,idx=304, vx=0,vy=0,mv=.1,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[3]={type=1,x=339,y=35,idx=304, vx=0,vy=0,mv=.001,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[4]={type=2,x=130,y=850,idx=304, vx=0,vy=0,mv=.04,mvup=-1,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[6]={type=3,x=430,y=830,idx=304, vx=0,vy=0,mv=.03,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[5]={type=2,x=62,y=760,idx=304, vx=0,vy=0,mv=.03,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[7]={type=1, x=155,y=777,idx=304, vx=0,vy=0,mv=.02,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[10]={type=2, x=111,y=365,idx=304, vx=0,vy=0,mv=.1,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[11]={type=2, x=111,y=365,idx=304, vx=0,vy=0,mv=.08,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[12]={type=2, x=111,y=365,idx=304, vx=0,vy=0,mv=.08,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[13]={type=3, x=186,y=343,idx=304, vx=0,vy=0,mv=.099,mvup=p.mvup,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} --global variables frict=.9 grav=.1 obj="Escapa" stsScr={sc=0,x1=70,x2=70,sw=true,vx=1} tryScr={colors={9,9},select=0} introScr={print1={y=63},print2={y=63}} intro=false tuto=false menu=true kills=0 trys=0 satsui=false fx_tm=false fx_gd=false guide=0 fx_bw={or_pal={},sat=0.0,satSt=0.06} device=pmem(2) s_dvc=false touch_controller={ {type='s', pos={ x=-20, y=-10, r=11 }, x=0, y=0, use=false, color=1}, {type='b', pos={ x=150, y=-80, r=5 }, hold=false, holdtime=0, press=false, color=2}, {type='b', pos={ x=170, y=-70, r=5 }, hold=false, holdtime=0, press=false, color=5} } joystickinuse=false if device==0 then s_dvc=true end if device==1 then mset(8,36,82) mset(10,36,83) end if device==2 then mset(8,36,87) mset(10,36,88) end --timers t=0 ti=0 tw=0 ts=0 tk=0 tfx=0 fxcd=0 tmsts=0 tmktn=0 time_over=500 --check progress if floor==1 then guide=1 p.x, p.y=hw,hh cats[1].x,cats[1].y=p.x,p.y end if floor==2 then guide=4 obj="Busca la llave y escapa" p.x, p.y=70,850 cats[1].x,cats[1].y=p.x,p.y end if floor==3 then p.x, p.y=32,700 cats[1].x,cats[1].y=p.x,p.y end if floor==4 then p.kunais=0 p.x, p.y=70,290 p.darkHado=true tuto2=true intro=false obj="Mata 2 dragones y luego escapa usando el SATSUI NO-HADO" cats[1].x,cats[1].y=p.x,p.y end if floor==5 then obj="Corre" p.kunais=0 p.x, p.y=185,368 cats[1].x,cats[1].y=p.x,p.y end for i = 0, 15 do fx_bw.or_pal[i] = peek(0x3FC0 + i * 3) * 65536 + peek(0x3FC0 + i * 3 + 1) * 256 + peek(0x3FC0 + i * 3 + 2) end --TUKI function TIC() if not s_dvc then if not menu then if not tuto2 then if not tuto then if not intro then --pre draw cls(0) map((p.x//240)*30,(p.y//136)*17,30,17,0,0,0) --natural order of things update() draw() controls() end end end end end --timer t=t+1 --intros if intro then s_intro() end if tuto and not tuto2 then s_tuto() end if tuto2 then s_tuto2() end if menu then s_menu() end if fx_gd then s_guide() end if s_dvc then s_device() end end --------- CONTROLES ------------ function controls() if debug then if key(2) then touch_drawcontroller(touch_controller,58,108) end end ctrls={up=false,dw=false,lf=false,rg=false,ktn=false,shd=false,kn=false,sts=false} if fx_tm then return end if p.death or p.win or menu then return end local mx,my,mcl,ccl,rcl=mouse() if device==1 then ctrls_keys() end if device==2 then ctrls_touch() end if ctrls.dw then c_down(p) end if ctrls.up then c_jump(p) end --baixo if ctrls.lf then c_left(p) end --esquerda if ctrls.rg then c_right(p) end --direita if ctrls.ktn then if not p.win or not p.death then if cond_attack2() then return end psfx(p,04) p.attack.id=1 p.attack.state=true end end if ctrls.shd then if not p.win or not p.death then p.attack.id=2 p.attack.state=true end end if ctrls.sts and p.darkHado then satsui=true end--attacks if ctrls.kn then atk_new_kunai(mx,my) end end function ctrls_keys() local x,y,left,center,right = mouse() ctrls.up=key(23) ctrls.dw=key(19) ctrls.lf=key(1) ctrls.rg=key(4) ctrls.ktn=right ctrls.kn=left ctrls.shd=key(64) ctrls.sts=key(4) and key(8) end function touch_updatejoystick(j,xo,yo) mx,my,mp=mouse() mx=mx-xo my=my-yo xdif=mx-j.pos.x ydif=my-j.pos.y if not joystickinuse and mp and (xdif^2+ydif^2)1 then local angle=math.atan2(j.y,j.x) j.x=math.cos(angle) j.y=math.sin(angle) end end function touch_updatebutton(b,xo,yo) mx,my,mp=mouse() mx=mx-xo my=my-yo xdif=mx-b.pos.x ydif=my-b.pos.y if not joystickinuse and mp and (xdif^2+ydif^2)0.5 ctrls.lf=touch_controller[1].x<-0.37 ctrls.rg=touch_controller[1].x>0.37 ctrls.ktn=touch_controller[2].holdtime>0 and touch_controller[2].holdtime<20 ctrls.shd=touch_controller[3].holdtime>0 and touch_controller[3].holdtime<20 ctrls.kn=mp and not joystickinuse if ctrls.ktn then tmsts=tmsts+1 if tmsts>20 then ctrls.sts=true end end if tmsts>0 then tmktn=tmktn+1 if tmktn>50 then tmktn=0 tmsts=0 end end if ctrls.shd then btninuse=true ctrls.kn=false end if ctrls.ktn then btninuse=true ctrls.kn=false end end -------- DRAW ----------- function draw() if p.death or p.win then return end --draw the border rectb(0,0,w,h,1) --draw the particles for i,d in pairs(dust) do if onscreen(d) then circ(d.x%240,d.y%136,d.r,d.c) end end --draw the player spr(p.idx+p.frm,p.x%240,p.y%136,0,1,p.flp) --draw the player bars & icons rectb(1,2,27,p.bar.w*2+9,05) rect(p.bar.x,p.bar.y+6,p.bar.vit,p.bar.w+4,p.bar.col) rect(p.bar.x,p.bar.y,p.bar.had,p.bar.w+3,15) local idsprH=500 local idsprV=498 if p.darkHado then idsprH=499 end if satsui then idsprV=502 end spr(idsprH,2+26,p.bar.y-2,0,1) spr(idsprV,2+27,p.bar.y+6,0,1) print("Objetivo:",0,20,6,false,1,true) print(obj,0,26,4,false,1,true) spr(480,0,30,0,1,0,0,1,2) print(":",7,41,1,false,1,true) print(p.kunais,10,40,1,false,1,true) --draw the cats for i,c in pairs(cats) do if onscreen(c) then spr(c.idx+c.frm,c.x%240,c.y%136,0,1,c.flp) end end --draw the powers if p.attack.state and p.attack.id==1 then if p.attack.id==1 then attack1(p) end end for i,k in pairs(kunais) do if onscreen(k) then spr(k.idx,k.x%240,k.y%136,0,1,k.flp) end end --draw the mobs for i,m in pairs(mobs) do if onscreen(m) and not m.death then spr(m.idx+m.frm,m.x%240,m.y%136,0,1,m.flp) end end --effects fx_animateDesaturation() fx_time() if satsui then spr(103,stsScr.x1,10,0,stsScr.sc) spr(103,stsScr.x2,10,0,stsScr.sc) spr(102,70,10,0,stsScr.sc) end end ----- UPDATES ------------------------ function update() update_player() update_bot() particles() end function update_player() --if the player death then return the try screen if p.death then p.death=true return s_try() end if p.win then p.win=true return s_win() end --detect the satsui no hado mode if satsui then s_satsuiNoHado() end --detect the shadow mode local shdMode =p.attack.state and p.attack.id==2 if shdMode then attack2(p) end --kunais atk_kunai() --bar configs local barVit=p.bar.vit*4 local barHad=p.bar.had*4 if p.vitc.x+8 then c_right(c) end --if the cat death teleport to the player if c.death then c.x, c.y=p.x, p.y c.death=false end --applies particles if collide(c,7,7) then new_dust(c.x+4,c.y+7,2.5) end --the same stuff from the update_player py(c,frict,1,grav) collide(c,7,7) move(c) checkanim(c) c.anim(c) c.anim=a_idle end -- MOBS -- --for all mobs in the list of mobs for i,m in pairs(mobs) do if not m.death then --movements -- mob type 1, directional if m.type==1 and onscreen(m) then if 1+t%60//30*2==1 then c_left(m) else c_right(m) end end -- mob type 2 & 3, follow the player if m.type==2 or m.type==3 then local cond=onscreen(m) if floor==5 then cond=true end if cond then if m.type==3 then m.idx=339 end --if there's a block in front, jump if fget(mget((m.x+8)//8,(m.y+3)//8),0) or fget(mget((m.x-1)//8,(m.y+3)//8),0) then c_jump(m) end --if the player is far, follow if p.xm.x+8 then c_right(m) end end end --if the mob is attacked if m.attacked then --checks the life of the mob m.dead=m.dead+1 if m.dead==5 then kills=kills+1 if floor==4 and kills>=2 then mset(13,43,28) end m.death=true end --save data local mvup=m.mvup local mv=m.mv --get nucked m.attacked=false m.mvup=-80 c_jump(m) m.mv=9 if m.flp==1 then c_right(m) else c_left(m) end --restore mob m.mvup=mvup m.mv=mv end --applies particles if collide(m,7,7) then new_dust(m.x+4,m.y+7,2.5) end --the same stuff from the update_player py(m,frict,1,grav) collide(m,7,7) move(m) checkanim(m) m.anim(m) m.anim=a_idle end end end --updates the particles function particles() for i,d in pairs(dust) do --applies physics and movement py(d,.95,.95,0) move(d) --changes its color overtime if d.t<5 then d.c=d.col+1 else d.c=d.col end if not cond_attack2() then --when the timer ends, gets tiny and then deleted d.t=d.t-1+rnd() if d.t<1 then d.r=d.r/1.1 end if d.r<1 then del(dust,i) end end end end ----- EFFECTS ----------------------- function fx_texts(o,x,y,cd,c,s) if not cd then cd=.2 end if not c then c=15 end if not s then s=1 end tfx=tfx+cd local pos=math.floor(tfx) local textoMostrado = string.sub(o,1,pos) print(textoMostrado,x,y,c,false,s,true) end function fx_desaturateColor(color, amount) local r, g, b = color // 65536, color // 256 % 256, color % 256 local gray = r * 0.3 + g * 0.59 + b * 0.11 return r + (gray - r) * amount, g + (gray - g) * amount, b + (gray - b) * amount end function fx_animateDesaturation() for i = 0, 15 do local r, g, b = fx_desaturateColor(fx_bw.or_pal[i], fx_bw.sat) poke(0x3FC0 + i * 3, r) poke(0x3FC0 + i * 3 + 1, g) poke(0x3FC0 + i * 3 + 2, b) end end function fx_BlackWhite(sw) if sw then fx_bw.sat = fx_bw.sat + fx_bw.satSt if fx_bw.sat>1.0 then fx_bw.sat=1.0 end end if not sw then fx_bw.sat = fx_bw.sat - fx_bw.satSt if fx_bw.sat<0 then fx_bw.sat=0 end end end function fx_time() if fx_tm then fx_BlackWhite(true) end if not fx_tm then fx_BlackWhite(false) end end ----- NEEDED FUNCTIONS --------------- function rset() fset(5,0,true) fset(5,4,false) stsScr={sc=0,x1=70,x2=70,sw=true,vx=1} tryScr={colors={9,9},select=0} introScr={print1={y=63},print2={y=63}} intro=true tuto=false menu=false kills=0 satsui=false obj="Escapa" fx_tm=false fx_gd=false guide=0 debug=false --player and all its variables p={x=hw,y=hh,idx=256,type="player", vx=0,vy=0,mv=.1,mvup=-2, frm=0,flp=0,w=7,h=7,attack={id=1,idx=288, frm=0, state=false}, vit=100,frz=1,rst=20,death=false, win=false, bar={x=2,y=3,vit=25,w=3,col=4,had=25}, hado=100, darkHado=false, kunais=7} --the cats list and all their variables cats={} cats[1]={x=hw,y=hh,idx=275, vx=0,vy=0,mv=.08,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,death=false} --the dust list for managing --the particles dust={} kunais={} --the enemys mobs={} mobs[1]={type=1, x=hw,y=10,idx=304, vx=0,vy=0,mv=.15,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[2]={type=1, x=223,y=72,idx=304, vx=0,vy=0,mv=.1,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[3]={type=1,x=339,y=35,idx=304, vx=0,vy=0,mv=.001,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[4]={type=2,x=130,y=850,idx=304, vx=0,vy=0,mv=.04,mvup=-1,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[6]={type=3,x=430,y=830,idx=304, vx=0,vy=0,mv=.03,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[5]={type=2,x=62,y=760,idx=304, vx=0,vy=0,mv=.08,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[7]={type=1, x=155,y=777,idx=304, vx=0,vy=0,mv=.02,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[10]={type=2, x=111,y=365,idx=304, vx=0,vy=0,mv=.1,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[11]={type=2, x=111,y=365,idx=304, vx=0,vy=0,mv=.08,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[12]={type=2, x=111,y=365,idx=304, vx=0,vy=0,mv=.08,mvup=-2,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} mobs[13]={type=3, x=186,y=343,idx=304, vx=0,vy=0,mv=.099,mvup=p.mvup,vit=999999,hado=1000000, frm=0,flp=0,w=7,h=7,attacked=false,dead=0,death=false} --timers t=0 ti=0 tw=0 ts=0 tk=0 --check progress if floor==1 then guide=1 p.x, p.y=hw,hh cats[1].x,cats[1].y=p.x,p.y end if floor==2 then guide=4 obj="Busca la llave y escapa" p.x, p.y=70,850 cats[1].x,cats[1].y=p.x,p.y end if floor==3 then p.x, p.y=32,700 cats[1].x,cats[1].y=p.x,p.y end if floor==4 then p.kunais=0 p.x, p.y=70,290 p.darkHado=true tuto2=true intro=false obj="Mata 2 dragones y luego escapa usando el SATSUI NO-HADO" cats[1].x,cats[1].y=p.x,p.y end if floor==5 then obj="Corre" p.kunais=0 p.x, p.y=185,368 cats[1].x,cats[1].y=p.x,p.y end end --applies an objects velocity to its position function move(o) o.x=o.x+o.vx o.y=o.y+o.vy end --applies friction and gravity on an object function py(o,frict_x,frict_y,grav) o.vx=o.vx*frict_x o.vy=o.vy*frict_y o.vy=o.vy+grav o.vy=min(max(o.vy,-3),3) end --checks if something is on the same map area of the player function onscreen(o) return p.x//240==o.x//240 and p.y//136==o.y//136 end --checks if an object is in the air to apply the right animation function checkanim(o) if o.vy>0 then o.anim=a_fall elseif o.vy<0 then o.anim=a_jump end if o.attack then if o.attack.state and o.attack.id==2 then o.anim=a_shadow end end end --plays a sfx if the object has the "player" tag function psfx(o,i) if o.type=="player" then sfx(i) end end --creates 10 new dust particles and put the in the dust list function new_dust(x_,y_,r_,c_) if not c_ then c_=14 end for i=0,10 do table.insert(dust, { x=x_, y=y_, col=c_, vx= cos(rnd(30))/2, vy= -sin(rad(rnd(180)))*(rnd()*2)/5, r=rnd()*r_, t=r_*5 }) end end --stop an object of passing through blocks --and returns true if it just hit the ground function collide(o,w,h) local r=false local x,vx,y,vy=o.x,o.vx,o.y,o.vy if fget(mget((x+vx) //8,(y) //8),0) or fget(mget((x+vx) //8,(y+h)//8),0) or fget(mget((x+vx+w)//8,(y) //8),0) or fget(mget((x+vx+w)//8,(y+h)//8),0) then o.vx=0 if o.type=="kunai" then o.coll=true end end if fget(mget((x+vx) //8,(y) //8),1) or fget(mget((x+vx) //8,(y+h)//8),1) or fget(mget((x+vx+w)//8,(y) //8),1) or fget(mget((x+vx+w)//8,(y+h)//8),1) then if o.type=="player" or floor==5 then o.vit=o.vit-14 o.hado=o.hado-10 else o.death=true end end if fget(mget((x+vx) //8,(y) //8),5) or fget(mget((x+vx) //8,(y+h)//8),5) or fget(mget((x+vx+w)//8,(y) //8),5) or fget(mget((x+vx+w)//8,(y+h)//8),5) then if o.type=="player" or floor==5 then o.vit=o.vit-0.2 o.hado=o.hado-0.05 else o.death=true end end if fget(mget((x+vx) //8,(y) //8),2) or fget(mget((x+vx) //8,(y+h)//8),2) or fget(mget((x+vx+w)//8,(y) //8),2) or fget(mget((x+vx+w)//8,(y+h)//8),2) then o.win=true end if fget(mget((x+vx) //8,(y) //8),3) or fget(mget((x+vx) //8,(y+h)//8),3) or fget(mget((x+vx+w)//8,(y) //8),3) or fget(mget((x+vx+w)//8,(y+h)//8),3) then if o.type=="player" then fset(5,0,false) fset(5,4,true) mset(o.x//8,o.y//8,0) end end if fget(mget((x+vx) //8,(y) //8),4) or fget(mget((x+vx) //8,(y+h)//8),4) or fget(mget((x+vx+w)//8,(y) //8),4) or fget(mget((x+vx+w)//8,(y+h)//8),4) then mset(o.x//8,o.y//8,6) psfx(o,07) end if fget(mget((x+vx) //8,(y) //8),6) or fget(mget((x+vx) //8,(y+h)//8),6) or fget(mget((x+vx+w)//8,(y) //8),6) or fget(mget((x+vx+w)//8,(y+h)//8),6) then if o.type=="player" then mset(o.x//8,o.y//8,0) fx_gd=true end end if fget(mget((x+vx) //8,(y) //8),7) or fget(mget((x+vx) //8,(y+h)//8),7) or fget(mget((x+vx+w)//8,(y) //8),7) or fget(mget((x+vx+w)//8,(y+h)//8),7) then if o.type=="player" then mset(151,042,23) mset(151,043,40) mset(151,044,40) mset(151,045,40) mset(151,046,40) mset(151,047,40) mset(151,048,39) mset(153,048,0) mobs[13].death=true cats[1].death=true fx_tm=true fx_texts("Continuara...",30,97) time_over=time_over-1 if time_over==0 then exit() end end end local vx=o.vx if fget(mget((x+vx) //8,(y+vy) //8),0) or fget(mget((x+vx+w)//8,(y+vy) //8),0) or fget(mget((x+vx) //8,(y+vy+h)//8),0) or fget(mget((x+vx+w)//8,(y+vy+h)//8),0)then if o.vy > .6 then r=true end o.vy=0 if o.type=="kunai" then o.coll=true end end if fget(mget((x+vx) //8,(y+vy) //8),1) or fget(mget((x+vx+w)//8,(y+vy) //8),1) or fget(mget((x+vx) //8,(y+vy+h)//8),1) or fget(mget((x+vx+w)//8,(y+vy+h)//8),1)then if o.type=="player" or floor==5 then o.vit=o.vit-14 o.hado=o.hado-10 else o.death=true end end if fget(mget((x+vx) //8,(y+vy) //8),5) or fget(mget((x+vx+w)//8,(y+vy) //8),5) or fget(mget((x+vx) //8,(y+vy+h)//8),5) or fget(mget((x+vx+w)//8,(y+vy+h)//8),5)then if o.type=="player" or floor==5 then o.vit=o.vit-0.2 o.hado=o.hado-0.05 else o.death=true end end if fget(mget((x+vx) //8,(y+vy) //8),2) or fget(mget((x+vx+w)//8,(y+vy) //8),2) or fget(mget((x+vx) //8,(y+vy+h)//8),2) or fget(mget((x+vx+w)//8,(y+vy+h)//8),2)then o.win=true end if fget(mget((x+vx) //8,(y+vy) //8),2) or fget(mget((x+vx+w)//8,(y+vy) //8),2) or fget(mget((x+vx) //8,(y+vy+h)//8),2) or fget(mget((x+vx+w)//8,(y+vy+h)//8),2)then mset(o.x+2,o.y,6) end if fget(mget((x+vx) //8,(y+vy) //8),6) or fget(mget((x+vx+w)//8,(y+vy) //8),6) or fget(mget((x+vx) //8,(y+vy+h)//8),6) or fget(mget((x+vx+w)//8,(y+vy+h)//8),6)then if o.type=="player" then mset(o.x//8,o.y//8,0) fx_gd=true end end if fget(mget((x+vx) //8,(y+vy) //8),7) or fget(mget((x+vx+w)//8,(y+vy) //8),7) or fget(mget((x+vx) //8,(y+vy+h)//8),7) or fget(mget((x+vx+w)//8,(y+vy+h)//8),7)then if o.type=="player" then mset(151,042,23) mset(151,043,40) mset(151,044,40) mset(151,045,40) mset(151,046,40) mset(151,047,40) mset(151,048,39) mset(153,048,0) mobs[13].death=true cats[1].death=true fx_tm=true end end --checks if the object is on the ground if fget(mget(x//8,(y+h+1)//8),0) or fget(mget((x+w)//8,(y+h+1)//8),0) then o.grnd = true else o.grnd = false end --checks if the object is below something if fget(mget(x//8,(y-1)//8),0) or fget(mget((x+w)//8,(y-1)//8),0) then o.ceil = false else o.ceil = true end --checks if an enemy is colliding with the player if not cond_attack2() then for i,m in pairs(mobs) do if not m.death then if math.floor(p.y)+5>=math.floor(m.y) and math.floor(p.y)-5<=math.floor(m.y) then if math.floor(p.x+5)>=math.floor(m.x) and math.floor(p.x)-5<=math.floor(m.x) then p.vit=p.vit-0.25 end end end end end return r end function shakeBar() p.bar.y=p.bar.y+1 if p.bar.y>=6 then p.bar.y=p.bar.y-5 end end ----- CONTROLS ----------------------- --if an object can jump, jump function c_jump(o) if o.type=="kunai" then o.vy=o.mvup psfx(o,1) end if o.grnd and o.ceil then o.vy=o.mvup psfx(o,1) end end function c_fall(o) o.vy=o.vy+o.mvdw end --crounching function c_down(o) o.anim=a_down if p.attack.state and p.attack.id==2 then return end o.down=true end --goes left function c_left(o) o.vx=o.vx-o.mv o.flp=1 if p.attack.state and p.attack.id==2 then return end o.anim=a_walk end --goes right function c_right(o) o.vx=o.vx+o.mv o.flp=0 if p.attack.state and p.attack.id==2 then return end o.anim=a_walk end ----- ANIMATIONS --------------------- function a_idle(o) if p.attack.state and p.attack.id==2 then return end if t%8==0 then o.frm=o.frm+1 end if o.frm>3 then o.frm=0 end end function a_walk(o) if p.attack.state and p.attack.id==2 then return end if t%14==0 then psfx(o,2) end if t%6==0 then o.frm=o.frm+1 end if o.frm<4 or o.frm>7 then o.frm=4 end end function a_down(o) if p.attack.state and p.attack.id==2 then return end o.frm=10 end function a_jump(o) if p.attack.state and p.attack.id==2 then return end o.frm=8 end function a_fall(o) if p.attack.state and p.attack.id==2 then return end o.frm=9 end function a_shadow(o) fx_tm=true if o.frm>=2 and o.frm<=3 then o.frm=11 end if t%3==0 then o.frm=o.frm+1 end if o.frm>18 then fx_tm=false o.attack.state=false end end ----- SCREENS -------------------- function s_try() fx_tm=false fx_gd=false local sel=false local mx,my,cl=mouse() if mx>48 and mx<106 then tryScr.select=0 end if mx>129 and mx<205 then tryScr.select=1 end if tryScr.select==0 then tryScr.colors[0]=1 tryScr.colors[1]=9 if cl or btnp(4) then trys=trys+1 pmem(1,pmem(1)+1) if trys>2 then reset() end rset() end else tryScr.colors[1]=1 tryScr.colors[0]=9 if cl or btnp(4) then reset() end end cls(00) print("Muertes:",0,0,6,false,1,true) print(pmem(1)+1,35,0) print("HAS MUERTO",60,40,2,false,2) print("Reintentar",50,90,tryScr.colors[0]) print("Menu Principal",130,90,tryScr.colors[1]) print("Click o toque en la opcion deseada",hh,hw,15,false,1,true) end function s_win() tw=tw+1 if tw==1 then pmem(0,floor+1) floor=pmem(0) end if tw%300==0 then p.win=false rset() fxcd=0 tfx=0 end p.attack.state=false for i,c in pairs(cats) do c.x=20 c.y=60 c.flp=0 end p.x=30 p.y=60 p.flp=0 cls(00) fx_tm=false fx_gd=false fx_texts("HAS ESCAPADO",40,40,.05,1,3) if tw>90 then print("Pasando a siguiente nivel...",0,0,2) end end function s_intro() if not intro then return end fx_tm=false fx_gd=false --check progress if floor==1 then p.x, p.y=hw,hh cats[1].x,cats[1].y=p.x,p.y end if floor==2 then p.x, p.y=70,850 cats[1].x,cats[1].y=p.x,p.y end if floor==3 then p.x, p.y=32,700 cats[1].x,cats[1].y=p.x,p.y end if floor==4 then p.kunais=0 p.x, p.y=70,290 p.darkHado=true obj="Matar 2 dragones y escapar." cats[1].x,cats[1].y=p.x,p.y end if floor==5 then p.kunais=0 p.x, p.y=185,368 cats[1].x,cats[1].y=p.x,p.y end --draw the locks in the map for i,l in pairs(locks) do mset(l.k.x,l.k.y,28) mset(l.r.x,l.r.y,5) mset(l.r.x+1,l.r.y,0) end --draw the guide-checks in the map for i,gd in pairs(gd_checks) do mset(gd.x,gd.y,45) end cls(00) ti=ti+1 if ti==1 then psfx(p,9) end spr(500,70,10,0,14) introScr.print1.y=introScr.print1.y+0.1 introScr.print2.y=introScr.print2.y-0.1 if introScr.print1.y>=66 then introScr.print1.y=introScr.print1.y+7 end if introScr.print2.y<=60 then introScr.print2.y=introScr.print2.y-7 end if ti>1 and ti<3 then cls(05) elseif ti>3 and ti<10 then cls(06) elseif ti>10 and ti<17 then cls(05) elseif ti>17 and ti<24 then cls(15) elseif ti>24 and ti<30 then cls(05) elseif ti>30 and ti<35 then cls(15) elseif ti>35 then cls(01) end local text="N1VEL UNO" if floor==1 then text=text elseif floor==2 then text="NIVEL DO2" elseif floor==3 then text="NIV3L TR3S" elseif floor==4 then text="NIVEL CU4TRO" elseif floor==5 then text="NIVEL 5INCO" else text=floor end local x=67 local sc=3 if text==floor then x=110 sc=6 end print(text,x,introScr.print1.y,06,false,sc,true) print(text,x,introScr.print2.y,06,false,sc,true) print(text,x,63,05,false,sc,true) if ti%170==0 then intro=false end end function s_tuto() if not tuto then return end local clr=15 local sel=false local mx,my,cl=mouse() if my>125 then clr=06 sel=true end local click=sel and cl map(119,118,30,17,0,0,-1,1) print("Click o toca aqui Para continuar",90,130,clr,false,1,true) print("KATANA",5,40,2) print("SHADOW",5,72,2) print("KUNAI",5,104,2) print("HADO ENERGY",35,10,2) print("VITALIDAD",35,18,2) print("PRECAUCIONES: Si la hado energy o",120,5,2,false,1,true) print("la vitalidad se acaba",120,10,2,false,1,true) print("MIKIRA MUERE",120,20,6,false,1,true) print("si la hado energy es poca",120,30,2,false,1,true) print("Mikira se vuelve lenta y",120,40,6,false,1,true) print("no podra usar habilidades",120,45,6,false,1,true) if btnp(4) or click then intro=true tuto=false tuto2=false end end function s_tuto2() if not tuto2 then return end local clr=15 local sel=false local mx,my,cl=mouse() if my>125 then clr=06 sel=true end local click=sel and cl map(77,120,30,17,0,0,-1,2) print("Si ves este icono junto a la barra de",31,0) print("Hado energy, podras activar el 'Satsui'",31,6) print("presionando las teclas 'H+D' o Boton",31,12) print("rosa dos veces seguidas.",31,18) print("Al activarlo la Hado energy y la",50,36) print("vitalidad se vuelven CASI infinitas,",50,42) print("debido a que aumentan 9 veces.",50,48) print("En este modo Mikira gana agilidad y",50,90) print("ademas salta mucho mas alto, por no",50,96) print("mencionar que ademas puede usar sus",50,102) print("habilidades con mas frecuencia",50,108) print("sin limitaciones.",50,114,1) print("Click o toca aqui para continuar",90,130,clr,false,1,true) if btnp(4) or click then tuto2=false tuto=true end end function s_satsuiNoHado() ts=ts+1 p.mv=.16 satsui=true if math.floor(math.random()*100)>70 then cls(1) end stsScr.sc=stsScr.sc+0.15 if stsScr.sc>3 then stsScr.x1=stsScr.x1+stsScr.vx stsScr.x2=stsScr.x2-stsScr.vx end if 20-ts<0 then stsScr.vx=8 end if 100-ts<0 then stsScr.sc=120 stsScr.x1=999 stsScr.x2=999 end if stsScr.sw then atk_satsuiNoHado() stsScr.sw=false end if 1000-ts<0 then satsui=false p.vit=1 p.hado=1 p.idx=256 p.mv=.04 p.mvup=-2 end if ts%90==0 then sfx(8) end end function s_menu() if not menu then return end map(101,118,30,17,0,0,-1,2) local c1,c2,c3=15,15,15 local s1,s2,s3=false,false,false local mx,my,cl=mouse() if my<46 then c1=06 x1=3 s1=true end if my>49 and my<68 then c2=06 x2=3 s2=true end if my>69 and my<74 then c3=06 x3=3 s3=true end print("NUEVO JUEGO",170,40,c1) print("CARGAR JUEGO",170,55,c2) print("CAMBIAR PLATAFORMA",135,70,c3) print("clickee o toque la opcion deseada",hh,hw,15,false,1,true) if cl and s1 then pmem(0,1) pmem(1,0) floor=pmem(0) menu=false tuto=true rset() music() end if cl and s2 then menu=false tuto=true music() end if cl and s3 then pmem(2,0) reset() end end function s_guide() fxcd=fxcd+1 local guides={} if device==1 then guides[1]={t="Bienvenida, muevete con WASD",x=60,y=108, cd=.2} guides[2]={t="desplazate a traves de los enemigos con SHIFT",x=60,y=118, cd=.4} guides[3]={t="apunta y dispara kunais con el mouse y click izquierdo",x=40,y=128, cd=.5} guides[4]={t="usa la katana con click derecho",x=20,y=h-8, cd=.25} guides[5]={t="PRECAUCION: los HORBITS solo pueden morir con kunais",x=30,y=90, cd=.4} end if device==2 then guides[1]={t="Bienvenida, muevete con el joystick",x=60,y=108, cd=.3} guides[2]={t="desplazate con el boton negro",x=60,y=118, cd=.4} guides[3]={t="apunta y dispara kunais tocando sobre el enemigo/objetivo",x=20,y=128, cd=.5} guides[4]={t="usa la katana con el boton rosa",x=20,y=h-8, cd=.25} guides[5]={t="PRECAUCION: los HORBITS solo pueden morir con kunais",x=30,y=90, cd=.4} end fx_texts(guides[guide].t, guides[guide].x, guides[guide].y, guides[guide].cd) fx_tm=true if fxcd>180 then fx_tm=false end if fxcd>220 then fxcd=0 tfx=0 fx_gd=false guide=guide+1 if floor==1 then if guide>3 then guide=3 end end if floor==2 then if guide>5 then guide=5 end if guide<4 then guide=4 end end end end function s_device() cls() device=0 local x,y,cl=mouse() local selectPC=357 local selectAndr=361 local hitboxes={pc={x1=30,y1=80,x2=80,y2=130}, andr={x1=160,y1=80,x2=210,y2=120}} if x>hitboxes.pc.x1 and xhitboxes.pc.y1 and yhitboxes.andr.x1 and xhitboxes.andr.y1 and y4 then o.attack.frm=0 o.attack.state=false end if o.flp==0 then spr(o.attack.idx+o.attack.frm,o.x%240+6,o.y%136,0,1,0) else spr(o.attack.idx+o.attack.frm,o.x%240-6,o.y%136,0,1,1) end --checks collisions with enemys & checks if the enemy is type 2 for i,m in pairs(mobs) do if math.floor(p.y)+6+5>=math.floor(m.y) and math.floor(p.y)-6-5<=math.floor(m.y) then local sideLeft=math.floor(m.x)-5>=math.floor(p.x) and math.floor(m.x)-12<=math.floor(p.x) and p.flp==0 local sideRight=math.floor(m.x)+5<=math.floor(p.x) and math.floor(m.x)+12>=math.floor(p.x) and p.flp==1 if sideLeft then if m.type==2 then m.attacked=true end sideLeft=false end if sideRight then if m.type==2 then m.attacked=true end sideRight=false end end end end function attack2(o) o.hado=o.hado-0.21 o.anim=a_shadow o.mv=.3 if o.flp==0 then c_right(o) elseif o.flp==1 then c_left(o) end o.mv=.1 end function atk_satsuiNoHado() if not satsui then return end p.hado=500 p.idx=320 p.mvup=-2.5 p.vit=500 p.bar.col=10 end function atk_kunai() for i,k in pairs(kunais) do tk=tk+1 if tk==1 then sfx(11) end if tk>=50 then new_dust(k.x+4,k.y+7,4,10) new_dust(k.x+4,k.y+7,4,10) new_dust(k.x+4,k.y+7,4,10) tk=0 sfx(12) del(kunais,i) end local tgt=k.tgt if not k.coll then if tgt.xk.x+10 then c_right(k) tgt.x=tgt.x+8 end if tgt.yk.y+10 then c_fall(k) tgt.y=tgt.y+8 end end --the same stuff from the update_player py(k,frict,1,k.gr) collide(k,1,5) move(k) if not k.coll then for i,m in pairs(mobs) do local hitby=k.y>m.y and k.ym.x and k.xm.x-10 local cond=floor==4 or floor==5 if hitby then if cond then sfx(13) end if not cond then if hitbxLeft then k.coll=true new_dust(m.x+4,m.y+7,1.6,4) sfx(14) --checks the life of the mob m.dead=m.dead+3 if m.dead==6 then kills=kills+1 if floor==4 and kills>=2 then mset(13,43,28) end m.death=true end end if hitbxRight then k.coll=true new_dust(m.x+4,m.y+7,1.6,4) sfx(14) --checks the life of the mob m.dead=m.dead+3 if m.dead==6 then kills=kills+1 if floor==4 and kills>=2 then mset(13,43,28) end m.death=true end end end end end end if k.coll then k.gr=0 k.vx=0 k.vy=0 k.x=k.x k.y=k.y end end end function atk_new_kunai(mx,my) if tk>0 then return end if p.kunais==0 then return end p.kunais=p.kunais-1 local pxc,pyc=(p.x//240)*30,(p.y//136)*17 local mxc,myc=mx+pxc*8,my+pyc*8 local flp=0 local kx,ky=p.x,p.y local x,y=mxc,myc local idx=294 local up=ky>y+10 local down=kyx+10 local limitx,limity=1920,1987 if up then idx=292 if y<0 then y=0 end end if down then idx=296 end if left then idx=293 if x<0 then x=0 end end if right then idx=293 if x>limitx then x=limitx end end if up and right then idx=294 end if up and left then idx=294 flp=1 end if down and left then idx=295 end if down and right then idx=295 end table.insert(kunais, { tgt={x=x,y=y}, x=kx, y=ky, idx=idx, gr=.1, vx=0, vy=0, mv=2, mvup=-20, mvdw=20, coll=false, flp=flp, frm=0, w=4, h=4, type="kunai" }) end function cond_attack2() local r=false if p.attack.state then if p.attack.id==2 then r=true end end return r end function z_debug(level) pmem(0,level) end