0,]']>S}Wup8d%qy)6o;]AsVl3???????????????????????004566778899999909099999999999JLMNOOOOOOOOOOOOOOOOOOOOOOOOORSVXZ[\]]^____________________013689:;<>>>==>>>>?===???>>??? "$&''''''''''''''''''''''''''HJLMNOOOOOOOOOOOOOOOOOOOOOOOOO        `CA@ @ @ B E H H JKLLLMMMNNMLMMNMMLMMO@ B EGILNOOOOOOOOOOOOOOOOOOOOOOO p 0 IJKLNOOOOOOOOOOOOOOOOOOOOOOOOO1!a!!a!a!!a!a!!a!a!!amBB BBmc c c c c c c c c c c cDD DD]$$ $$e e e e e e e e e e e eee ee e eee ee ee e e e eee ee eee e eeeee ee eee ee e eff ffff fh Hhhhhhm      ]   S SS S SSS SS S SSS SS S SSS SS S SSS SS S SSS S=           d- S SS S SSS SS S SSS SS S SSS S@@BaBaBaBaBa Ba Ba$Ba(Ba ppvvvvv ?         """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 """"""""""""""""""""""""""""""" """"""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""          xwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwxggggggggggggggggggggggggggggggggggggggggggggggxvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvxwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwxwwwwwwwwwwwwwwwwwwwwwww               b-- title: AntVania -- author: Muhammad Fauzan -- desc: Metroidvania Month 14 -- script: lua scn=0 zClick=false tim={--time inv=0,--invisible an=0--animation } pla={--player an=0,--animation f=0,--flip x=0, y=0, vx=0, vy=0, sp=1,--speed hl=3,--health wp=0,--weapon ab=0,--ability td=0,--time dead inv=false,--invisible eup=false,--power up effect grv=true,--gravity } swo={--sword x=0, y=0, t=0, ac=true--active } bwo={--bow x=0, y=0, t=0, sp=193, am=0,--amount ac=true--active } cam={--camera mx=0, my=0, x=0, y=0, a=1, ll=0,--left limit lr=0,--right limit lu=0,--up limit ld=0,--down limit sh=false--shake } shake=0 sav={--save px=0, py=0, hl=0, wp=0, bw=0, ab=0, ded=0 } isHeal=false isSave=false cir={}--circle slh={}--sword slash arw={}--arrow eup={}--effect power up edm={}--effect damage exp={}--effect explosion spw={}--spawn enemy ebg={}--enemy bug efl={}--enemy fly ehg={}--enemy hedgehog bhg={}--bullet hedgehog ssl={}--spawn banaspati esl={}--banaspati glm={}--golem clm={}--crimson golem gpw={}--cGolem power bos1={}--boss 1 bos1Ded=false bos2={}--boss 2 bos2Ded=false ston={}--falling stone dbg=false function debug() local d=dbg local p=pla local c=cam local sv=sav local sav=isSave if keyp(4) then if not d then dbg=true else dbg=false end end if d then print("playerX: "..p.x.."",8,16,12) print("playerY: "..p.y.."",8,24,12) print("cameraX: "..c.x.."",8,32,12) print("cameraY: "..c.y.."",8,40,12) print("camLimL: "..c.ll.."",8,48,12) print("camLimR: "..c.lr.."",8,56,12) print("camLimU: "..c.lu.."",8,64,12) print("camLimD: "..c.ld.."",8,72,12) print(sav,8,80,12) print("pmem0(pX): "..pmem(0).."",8,88,12) print("pmem1(pY): "..pmem(1).."",8,96,12) print("pmem2(hl): "..pmem(2).."",8,104,12) print("pmem3(wp): "..pmem(3).."",8,112,12) print("pmem4(ab): "..pmem(4).."",8,120,12) print("pmem5(bw): "..pmem(5).."",8,128,12) -- print("slash: "..#slh.."",96,16,12) print("arrow: "..#arw.."",96,24,12) print("effUp: "..#eup.."",96,32,12) print("effdm: "..#edm.."",96,40,12) print("irisS: "..#cir.."",96,48,12) print(p.inv,96,56,12) print("explosion: "..#exp.."",96,64,12) print("death: "..sv.ded.."",96,80,12) -- print("spawn: "..#spw.."",176,16,12) print("bug: "..#ebg.."",176,24,12) print("fly: "..#efl.."",176,32,12) print("fly: "..#efl.."",176,32,12) print("hedge: "..#ehg.."",176,40,12) print("hedgeBul: "..#bhg.."",176,48,12) print("sSoul: "..#ssl.."",176,56,12) print("soul: "..#efl.."",176,64,12) print("golem: "..#glm.."",176,72,12) print("cGolem: "..#clm.."",176,80,12) print("golemPow: "..#gpw.."",176,88,12) print("boss 1: "..#bos1.."",176,104,12) print("boss 2: "..#bos2.."",176,112,12) print("stone: "..#ston.."",176,120,12) end end function TIC() render()--debug() end pMusic=false function _music(tr,lo) if not pMusic then music(tr,-1,-1,lo) pMusic=true end end --save & load function save() local p=pla local sv=sav local bw=bwo local flr=math.floor sv.px=flr(p.x) sv.py=flr(p.y) sv.hl=p.hl sv.wp=p.wp sv.bw=bw.am sv.ab=p.ab pmem(0,sv.px)pmem(1,sv.py) pmem(2,sv.hl) pmem(3,sv.wp)pmem(5,sv.bw)pmem(4,sv.ab) pmem(6,sv.ded) isSave=true end function load() local p=pla local bw=bwo fade(32,-1) p.x=pmem(0)p.y=pmem(1) p.hl=pmem(2) p.wp=pmem(3)bw.am=pmem(5)p.ab=pmem(4) sav.ded=pmem(6) end function newGame() local p=pla local bw=bwo fade(32,-1) pmem(0,0) p.x=56 p.y=112 p.grv=true p.hl=3 p.wp=0 bw.am=0 p.ab=0 sav.ded=0 end ------------ function render() local s=scn --title if s==0 then sTitle() --game elseif s==1 then sGame() --game over elseif s==2 then sOver() end end function sTitle() --music _music(0,true) ------- map(210,102) spr(240,56,40,0,2,0,0,8,1) print("Game by MFauzan",92,60,8,false,1,true) if not zClick then if time()%1000>500 then print("PRESS TO START",74,98,8) print("PRESS TO START",74,97,12) spr(188,109,96) end if btnp(4) then sfx(48,'c-3',30) zClick=true end else local coC=14--continue color if pmem(0)>0 then coC=12 end spr(184,84,87)print("TO CONTINUE",96,88,coC) spr(185,84,103)print("TO NEW GAME",96,104,12) --continue if pmem(0)>0 and btnp(0) then sfx(48,'c-3',30) load() scn=1 end --new game if btnp(1) then sfx(48,'c-3',30) newGame() scn=1 end end end init=false function sInit() --music pMusic=false _music(2,true) ------- Spawn(39,12,0)Spawn(15,29,0)Spawn(104,10,0)Spawn(169,6,0)Spawn(82,44,0)Spawn(156,45,0)Spawn(171,60,0) Spawn(84,56,1)Spawn(191,71,1)Spawn(145,73,1)Spawn(106,75,1)Spawn(75,74,1)Spawn(56,74,1) Spawn(224,64,2)Spawn(216,57,2)Spawn(233,57,2)Spawn(224,41,2)Spawn(226,31,2) Spawn(67,11,3)Spawn(101,28,3)Spawn(184,45,3)Spawn(126,79,3) Spawn(50,96,4)Spawn(83,96,4) SSoul(128,96)SSoul(154,96)SSoul(184,96)SSoul(64,113) EBos1(194,115) EBos2(217,123) end function sGame() local p=pla local c=cam local bw=bwo local rnd=math.random if not init then sInit()init=true end --change area if p.x>0 and p.x<1680 and ((p.y>0 and p.y<816) or (p.y>952 and p.y<1088)) then c.ll=0 c.lr=-1440 c.lu=(p.y//136)*-136 c.ld=c.lu elseif p.x>0 and p.x<1440 and p.y>816 and p.y<952 then c.ll=0 c.lr=-1200 c.lu=-816 c.ld=c.lu elseif (p.x>1440 and p.x<1680 and p.y>816 and p.y<952) or (p.x>1680 and p.x<1920 and p.y>952 and p.y<1088) then c.ll=(p.x//240)*-240 c.lr=c.ll c.lu=(p.y//136)*-136 c.ld=c.lu elseif p.x>1680 and p.x<1920 and p.y>0 and p.y<816 then c.ll=-1680 c.lr=c.ll c.lu=0 c.ld=-680 end --camera c.x=112-p.x c.y=68-p.y if c.x>c.ll then c.x=c.ll end if c.xc.lu then c.y=c.lu end if c.y0 then poke(0x3FF9,rnd(-d,d)) poke(0x3FF9+1,rnd(-d,d)) shake=shake-1 if shake==0 then memset(0x3FF9,0,2) c.sh=false end end end --object drawEBos1() drawEBos2() drawSpawn() drawEBug() drawEFly() drawEHedg() drawSSoul() drawESoul() drawEGolem() drawECGolem() drawEGPower() drawEHgBul() drawEStone() if p.wp==0 then getSword(32,240) end if bw.am==0 then getBow(1708,160) end if bos1Ded then getGrav(1556,928) end hud()player() drawSlash() drawArrow() drawEffUp() drawEffDam() drawEffExplode() drawFade() --the end if bos2Ded then sEnd() end end function sEnd() local c=cam print("THE END",1752+c.x,1008+c.y,6,true,2) print("DEATHS : "..sav.ded.."",1760+c.x,1032+c.y,12,true) end function sOver() init=false mset(210,126,81)mset(210,127,81) cls() print("GAME OVER",68,56,2,false,2) if time()%1000>500 then spr(188,90,87,0)print("CONTINUE",104,88,12) end if btnp(4) then sfx(48,'c-3',30) pmem(6,sav.ded) if pmem(0)>0 then load() else newGame() end scn=1 end end function solid(x,y) return mget(x//8,y//8)<80 end function saveArea(x,y) local saveA={[160]=true,[161]=true} return saveA[(mget(x//8,y//8))] end function healArea(x,y) local healA={[162]=true,[163]=true} return healA[(mget(x//8,y//8))] end function shroom(x,y) local shrmA={[77]=true,[78]=true,[79]=true} return shrmA[(mget(x//8,y//8))] end function spike(x,y) local spikA={[97]=true,[98]=true} return spikA[(mget(x//8,y//8))] end function water(x,y) local watrA={[99]=true,[144]=true} return watrA[(mget(x//8,y//8))] end function dart(x,y) return mget(x//8,y//8)==64 end function hud() local p=pla local h=p.hl*8 --bg rect(0,0,240,14,0) --health for x=8,24,8 do spr(177,x,2,0) end for x=8,h,8 do spr(176,x,2,0) end --weapon spr(178,160,2,0) spr(179,176,2,0) if p.wp==0 then spr(183,168,2,0)--? elseif p.wp==1 then spr(189,152,2,0)--button spr(180,168,2,0)--sword elseif p.wp==2 then spr(189,152,2,0)--button spr(181,168,2,0)--bow & arrow else end --power spr(178,208,2,0) spr(179,224,2,0) if p.ab>0 then spr(190,200,2,0)--button spr(182,216,2,0)--power up else spr(183,216,2,0) end --save local sav=isSave if saveArea(p.x+4,p.y+4) then spr(164,48,2,0) if not sav then sfx(49,'e-6',30) effUp(12) save()isSave=true end else isSave=false end --frame rectb(0,14,240,122,1) end --weapon function getSword(x,y) local c=cam local p=pla spr(180,x+c.x,y+c.y,0) if p.x+4>x and p.x+4y and p.y+420 then sw.ac=true end end --attack if btnp(5) then if sw.ac then sfx(54,'c-5',10) slash(x+sw.x*3,y,f) sw.ac=false end end end function slash(mx,my,mf) local s={x=mx,y=my,f=mf,t=0} slh[#slh+1]=s end function drawSlash() local t=tim local c=cam local sl=slh for i,s in pairs(sl) do s.t=s.t+1 spr(200+t.an%12//3,s.x+c.x,s.y+c.y,0,1,s.f) if s.t==12 then table.remove(slh,i) end end end function getBow(x,y) local p=pla local c=cam local bw=bwo spr(181,x+c.x,y+c.y,0) if p.x+4>x and p.x+4y and p.y+415 then bw.ac=true end end spr(bw.sp,x+bw.x+c.x,y+bw.y+c.y,0,1,f) --attack if btnp(5) and bw.ac then sfx(53,'c-5',20) arrow(x+bw.x,y+4,bw.x) bw.sp=194 bw.ac=false end end function arrow(mx,my,mvx) local ar={x=mx,y=my,vx=mvx,t=0} arw[#arw+1]=ar end function drawArrow() local c=cam local ar=arw for i,ar in pairs(ar) do ar.t=ar.t+1 ar.x=ar.x+ar.vx pix(ar.x+c.x,ar.y+c.y,12) if ar.t==20 or solid(ar.x,ar.y) then table.remove(arw,i) end if dart(ar.x,ar.y) then mset(ar.x//8,ar.y//8,81) end end end function getGrav(x,y) local p=pla local c=cam spr(165,x+c.x,y+c.y,0) if p.x+4>x and p.x+4y and p.y+40 then if p.wp==1 then p.wp=2 else p.wp=1 end end --active gravity ability if btnp(6) and p.ab==1 then if p.grv then p.f=2 p.vy=-1 p.grv=false else p.f=0 p.grv=true end end --collision u=p.y+p.vy d=p.y+p.vy+8 l=p.x+p.vx r=p.x+p.vx+7 if solid(l,u+1) or solid(l,d-1) or solid(r,u+1) or solid(r,d-1) then p.vx=0 end --gravity if solid(l+1,d) or solid(r-1,d) then p.vy=0 else if p.grv then p.vy=p.vy+0.2 else p.vy=p.vy-0.1 end end --jump if p.vy==0 and btnp(4) then sfx(50,'c-3',30)p.vy=-3 end if shroom(l,d) or shroom(r,d) then p.vy=-4 end --collision up if p.vy<0 and (solid(l+2,u) or solid(r-2,u)) then p.vy=0 end --update movement p.x=p.x+p.vx p.y=p.y+p.vy --limit health if p.hl<0 then p.hl=0 end if p.hl>3 then p.hl=3 end --heal local heal=isHeal if healArea(l+4,u+4) then if not heal then sfx(49,'e-6',30)effUp(5)p.hl=3 isHeal=true end else isHeal=false end --weapon if p.wp==1 then sword(l,u,p.f) elseif p.wp==2 then bow(l,u,p.f) end --invisible if p.inv then t.inv=t.inv+1 --blink if time()%200>100 then spr(208+p.an,p.x+c.x,p.y+c.y,0,1,p.f) end if t.inv==60*2 then t.inv=0 p.inv=false end --draw else spr(208+p.an,p.x+c.x,p.y+c.y,0,1,p.f) end --damage by spike and water if not p.inv and spike(l+4,u+4) then EAtt2() end if water(l+4,u+4) then EAtt2() end --dead if p.hl<1 then if #cir==0 then p.td=0 fade(0,1) end p.td=p.td+1 if p.td==32 then --music pMusic=false _music(1,false) ------- sv.ded=sv.ded+1 scn=2 end end end --enemy function ESolid(l,r,u,d)--enemy collision return solid(l-1,u+4) or solid(r+1,u+4) or not solid(l,d) or not solid(r,d) end function EAtt(l,r,u,d)--enemy attack local p=pla local c=cam if not p.inv and p.x+4>l and p.x+4u and p.y+4l and sw.yu end --arrow local ar=arw for j,ar in pairs(ar) do if not dam and ar.x>l and ar.xu and ar.yx+240 or p.yy+136 end function Spawn(mx,my,me) local s={ x=mx*8, y=my*8, e=me,--enemy a=false--active } spw[#spw+1]=s end function drawSpawn() local p=pla local c=cam local sp=spw for j,s in pairs(sp) do if p.x>s.x-240 and p.xs.y-136 and p.y12 then e.d=false end else e.an=t.an%24//12 e.sp=212 e.t=0 end --dead if e.h<0 then EDed(l,u) end if EWipe(e.x,e.y,e.h) then table.remove(ebg,i) end if p.hl==0 then ebg[i]=nil end end end function EFly(mx,my) local e={x=mx,y=my,an=0,h=1,d=false} efl[#efl+1]=e end function drawEFly() local t=tim local p=pla local c=cam local fl=efl for i,e in pairs(fl) do local u=e.y+2 local d=e.y+6 local l=e.x+4 local r=e.x+6 --movement local dx=p.x-e.x local dy=p.y-e.y local sqrt=math.sqrt local dist=sqrt((dx*dx)+(dy*dy)) if p.x>e.x-96 and p.xe.y-16 and p.xs.x-120 and p.xs.y-64 and p.ye.x+4 then e.f=0 else e.f=1 end spr(228+t.an%24//6,e.x+c.x,e.y+c.y,0,1,e.f) --attack if EAtt(l,r,u,d) then table.remove(esl,i) end --damage if EDam(l,u,8,8,e.d) then e.h=e.h-1 EDed(l,u) end --dead if EWipe(e.x,e.y,e.h) then table.remove(esl,i) end if p.hl==0 or bos2Ded then esl[i]=nil end end end function EGolem(mx,my) local e={ x=mx, y=my, sp=256,--sprite f=0,--flip h=10,--health ta=0,--time attack td=0,--time damage te=0,--time explode c=0,--collision d=false--damage } glm[#glm+1]=e end function drawEGolem() local t=tim local p=pla local c=cam local gl=glm for i,e in pairs(gl) do local u=e.y local d=e.y+32 local l=e.x local r=e.x+32 --draw if p.x>l+16 then e.f=0 e.c=32 else e.f=1 e.c=0 end spr(e.sp,e.x+c.x,e.y+c.y,6,1,e.f,0,4,4) --attack if p.x+4>l+14 and p.x+4u and p.y+460*2 and e.ta<60*3 then e.sp=260 elseif e.ta>60*3 and e.ta<60*3.5 then e.sp=264 EAtt(l-8,r+8,u,d) elseif e.ta==60*3.5 then e.ta=0 else e.sp=256 end --damage if EDam(l+8,u,16,32,e.d) then effDam(l+16,u+16) e.h=e.h-1 e.d=true end if e.d then e.td=e.td+1 if e.td>12 then e.d=false end else e.td=0 end --dead if e.h<0 then e.te=e.te+1 if e.te==15 then EDed(l+16,u+16) elseif e.te==30 then EDed(l+16,u+16) elseif e.te==45 then EDed(l+16,u+16)table.remove(glm,i) end end if p.xl+240 or p.yu+136 then table.remove(glm,i) end if p.hl==0 then glm[i]=nil end end end function EGPower(mx,my,mf) local e={x=mx,y=my,vx=0,f=mf,t=0} gpw[#gpw+1]=e end function drawEGPower() local t=tim local p=pla local c=cam local pw=gpw for i,e in pairs(pw) do local u=e.y+8 local d=e.y+17 local l=e.x local r=e.x+16 if e.f==0 then e.vx=2 else e.vx=-2 end e.x=e.x+e.vx --draw spr(364+t.an%10//5*2,e.x+c.x,e.y+c.y,0,1,e.f,0,2,2) --attack EAtt(l,r,u,d) --remove e.t=e.t+1 if e.t==60*2 or solid(l,u+1) or solid(r,u+1) or not solid(l,d) or not solid(r,d) then table.remove(gpw,i) end if p.hl==0 then gpw[i]=nil end end end function ECGolem(mx,my) local e={ x=mx, y=my, sp=320,--sprite f=0,--flip h=15,--health ta=0,--time attack td=0,--time damage te=0,--time explode c=0,--collision d=false--damage } clm[#clm+1]=e end function drawECGolem() local t=tim local p=pla local c=cam local gl=clm for i,e in pairs(gl) do local u=e.y local d=e.y+32 local l=e.x local r=e.x+32 --draw if p.x>l+16 then e.f=0 e.c=32 else e.f=1 e.c=0 end spr(e.sp,e.x+c.x,e.y+c.y,6,1,e.f,0,4,4) --attack if p.x+4>l+14 and p.x+4u and p.y+460*2 and e.ta<60*3 then e.sp=324 elseif e.ta==60*3 then EGPower(l+16,u+16,e.f) elseif e.ta>60*3 and e.ta<60*3.5 then e.sp=328 EAtt(l-8,r+8,u,d) elseif e.ta==60*3.5 then e.ta=0 else e.sp=320 end --damage if EDam(l+8,u,16,32,e.d) then effDam(l+16,u+16) e.h=e.h-1 e.d=true end if e.d then e.td=e.td+1 if e.td>12 then e.d=false end else e.td=0 end --dead if e.h<0 then e.te=e.te+1 if e.te==15 then EDed(l+16,u+16) elseif e.te==30 then EDed(l+16,u+16) elseif e.te==45 then EDed(l+16,u+16)table.remove(clm,i) end end if p.xl+240 or p.yu+136 then table.remove(clm,i) end if p.hl==0 then clm[i]=nil end end end function EBos1(mx,my) local e={ x=mx*8, y=my*8, vx=.7, vy=0, dx=1, sp=218,--sprite f=0,--flip h=33,--health ts=0,--time shoot tg=0,--time gravity te=0,--time explode a=false,--active d=false,--damage gr=true--gravity } bos1[#bos1+1]=e end function drawEBos1() local t=tim local p=pla local c=cam local bo=bos1 for i,e in pairs(bo) do if p.x>1440 and p.x<1680 and p.y>816 and p.y<952 then local u=e.y local d=e.y+16 local l=e.x local r=e.x+16 --movement if solid(l,u+8) or solid(r,u+8) then e.vx=e.vx*-1 end e.x=e.x+e.vx if e.vx>0 then e.dx=1 elseif e.vx<0 then e.dx=-1 else e.dx=e.dx end --gravity e.tg=e.tg+1 if e.tg==60*12 then if e.gr then e.f=2 e.y=e.y-5 e.gr=false else e.f=0 e.y=e.y+5 e.gr=true end e.tg=0 end if solid(l+8,d) or solid(l+8,u-4) then e.vy=0 else if e.gr then e.vy=e.vy+0.1 else e.vy=e.vy-0.1 end end e.y=e.y+e.vy --draw spr(e.sp+t.an%18//6*2,e.x+c.x,e.y+c.y,0,1,e.f,0,2,2) --attack e.ts=e.ts+1 if e.ts>60*7 and e.ts<60*7.9 then e.vx=0 elseif e.ts==60*8 then for i=0,360,45 do EHgBul(l+8,u+12,i) end elseif e.ts>60*9 then e.vx=.7*e.dx e.ts=0 end EAtt(l+2,r-2,u+2,d) --damage if EDam(l,u,16,16,e.d) then effDam(l+8,u+8)e.h=e.h-1 e.d=true end if e.d then e.td=e.td+1 if e.td>12 then e.d=false end else e.td=0 end --dead if e.h<0 then e.te=e.te+1 if e.te==15 then EDed(l+8,u+8) elseif e.te==30 then EDed(l+8,u+8) elseif e.te==45 then EDed(l+8,u+8)table.remove(bos1,i)bos1Ded=true end end end if p.hl==0 then bos1[i]=nil end end end function EStone(mx,my) local s={x=mx,y=my} ston[#ston+1]=s end function drawEStone() local p=pla local c=cam local st=ston for i,s in pairs(st) do local u=s.y local d=s.y+8 local l=s.x local r=s.x+8 --move s.y=s.y+1 --draw spr(16,s.x+c.x,s.y+c.y) --attack EAtt(l,r,u,d) --dead if solid(l+4,d) then table.remove(ston,i) end if p.hl==0 then ston[i]=nil end end end function EBos2(mx,my) local e={ x=mx*8, y=my*8, dx=1, sp=384,--sprite h=40,--health ts=0,--time shoot te=0,--time explode td=0,--time damage d=false,--damage } bos2[#bos2+1]=e end function drawEBos2() local t=tim local p=pla local c=cam local bo=bos2 local rnd=math.random for i,e in pairs(bo) do if p.x>1680 and p.x<1920 and p.y>952 and p.y<1088 then local u=e.y local d=e.y+64 local l=e.x local r=e.x+128 --close door if p.x>1688 then mset(210,126,1)mset(210,127,1) end --draw spr(e.sp,e.x+c.x,e.y+c.y,0,1,0,0,8,8) spr(e.sp,e.x+64+c.x,e.y+c.y,0,1,1,0,8,8) --attack e.ts=e.ts+1 if e.ts==60*8 then ESoul(l+16,u+20) ESoul(r-16,u+20) e.ts=0 end --damage if EDam(l,u,128,64,e.d) then effDam(l+64,u+32)e.h=e.h-1 e.d=true for sx=rnd(212,214),237,4 do local sy=rnd(123,125) EStone(sx*8,sy*8) end end if e.d then e.t=e.t+1 e.sp=392 if e.t>12 then e.d=false end else e.sp=384 e.t=0 end --dead if e.h<0 then e.te=e.te+1 if e.te==15 then EDed(l+64,u+32) elseif e.te==30 then EDed(l+64,u+32) elseif e.te==45 then EDed(l+64,u+32)table.remove(bos2,i)bos2Ded=true end end end if p.hl==0 then bos2[i]=nil end end end --misc function effUp(mc) local e={x=0,y=0,c=mc,r=16} eup[#eup+1]=e end function drawEffUp() local p=pla local c=cam local up=eup for i,e in pairs(up) do e.x=p.x+4 e.y=p.y+4 e.r=e.r-1 circb(e.x+c.x,e.y+c.y,e.r,e.c) if e.r<0 then p.eup=false table.remove(eup,i) end end end function effDam(mx,my) local e={x=mx,y=my,r=0} edm[#edm+1]=e end function drawEffDam() local p=pla local c=cam local dm=edm for i,e in pairs(dm) do e.r=e.r+1 circ(e.x+c.x,e.y+c.y,e.r,2) if e.r>8 then table.remove(edm,i) end end end function effExplod(mx,my,ma) local l={x=mx,y=my,a=ma,rd=0,t=0} exp[#exp+1]=l end function drawEffExplode() local t=tim local c=cam local xp=exp local rad=math.rad local sin=math.sin local cos=math.cos for i,l in pairs(xp) do local dir=rad(l.a) l.x=l.x+sin(dir)*2 l.y=l.y-cos(dir)*2 circ(l.x+c.x,l.y+c.y,l.rd+t.an%12//3,4) l.t=l.t+1 if l.t==20 then table.remove(exp,i) end end end function fade(mrad,mz) local f={ x=0, y=0, z=mz, rad=mrad,--radius min=-10, max=32 } cir[#cir+1]=f end function drawFade() local ci=cir for i,f in pairs(ci) do f.rad=f.rad+f.z for x=0,240,30 do for y=0,136,17 do circ(x,y,f.rad,0) end end if f.radf.max then table.remove(cir,i) end end end