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DtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwDGDDDGDDDGDDDGDDDGDD""""""""""""DGDDDGDDDGDDDGDDDGDDDGDD""""""""""""pDGDDDGDDDGDDDGDDDGDDDGDD""""""""""""DGDDwwwwwwwwwwwwwwwwwwww""""""""""""wwwwDDtDDDtDDDtDDDtDDDtD""""""""""""pDDtDDDtDDDtDDDtDpDDtDDDtD""""""""""""DDtDDDtDDDtDDDtDDDtDDDtD""""""""""""DDtDwwwwwwwwwwwwwwwwwwww""""""""""""wwwwDGDDDGDDDGDD""""""""""""""""""""""""DGDDDGDDDGDDDGDDDGDDDGDDDGDDDDDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDD""""""""""""""""""""""""DwDDDGDDDGDDDGDDDGDDDGDDDGDD@DDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDp"""""""""""""""""""""'""DwDDDGDDDGDDDGDDDGDDDGDDDGDDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDwwwwwwwwwwww"""""""""""""""""""""'""wwwwwwwwwwwwwwwwwwwwwwwwwwwwDDDDwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwDDtDDDtDDDtD"""""""""""""""""""""w""twtDDDtDDDtDDDtDDDtDDDtDDDtDD@DDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtD"""""""""""""""""""""r""tGtDDwtDDDtDDDtDDDtDDDtDDDtDDDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDp"""""""""""""""""""""r'"wGttwGtDDDtDDDtDDDtDDDtDDDtDDDDDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDwwwwwwwwwwww"""""""""""""""""""""r'rwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwDGDDDGDDDGDD""""""""ww`ff"""""rwrwwww'"""""""""""""""""""""""DGDDDDDDDGDD""""""""""""""""""""""""DGDDDGDDDGDDDGDDDGDD""""""""p33`w"""""rwwwwww""""""""""""""""""""""""DGDD@DDDGDD""""""""""""""""""""""""DGDDDGDDDGDDDGDDDGDD""""""""71s`w""r'"rwwwwww'"""""""""""""""""""""""DGDDDDGDD""""""""""""""""""""""""DGDDDGDDwwwwwwwwwwww""""""""71s`q""rw'rwwwwwwww""""""""""""""""""""""wwwwDDDDwwww""""""""""""""""""""""""wwwwwwwwDDtDDDtDDDtD""""""""71s`w"""wwwwwwwwwww""""""""""""""""""""DDtDD@DDtD""""""""""""""""""""""""DDtDDDtDDDtDDDtDDDtD""""""""71sp`w"""rwwwwpwwwww""""""""""""""""""""DDtDDDDDtD""""""""""""""""""""""""DDtDDDtDDDtDDDtDDDtD""""""""p33ff""""wwwww"""""""""""""""""""""""DDtDDDDDDDtD""""""""""""""""""""""""DDtDDDtDwwwwwwwwwwww""""""""ww`""""rwwpw'""""""""""""""""""""""wwwwwwww""""""""""""""""""""""""wwwwwwwwDGDDDGDDDGDD""""""""""""rwwpw'""DGDDDGDDDGDDDGDDDGDDDDDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDD@DDDGDDDGDDDGDD"""""""""""""wwpww""DGDDDGDDDGDDDGDDDGDD@DDDGDDDGDDDGDDDGDDDGDDDGDDDGDDD""DDGDDDGDDDGDD""""""""""wwwwwwww'"DGDDDGDDDGDDDGDDDGDDDDGDDDGDDDGDDDGDDDGDDDGDDDGDD$""Bwwwwwwwwwwww""""""""""wwwwwwpwwww"wwwwwwwwwwwwwwwwwwwwDDDDwwwwwwwwwwwwwwwwwwwwwwwwwwww ""DDtDDDtDDDtD""""""""""""wwwwww'rw'DDtDDDtDDDtDDDtDDDtDD@DDtDDDtDDDtDDDtDDDtDDDtDDDtD$""BDDtDDDtDDDtD""""""""ppp"""""rwwwwww'"r'DDtDDDtDDDtDDDtDDDtDDDDDtDDDtDDDtDDDtDDDtDDDtDDDtD$ "BDDtDDDtDDDtD""""""""""""""wwwwww'"""DDtDDDtDDDtDDDtDDDtDDDDDDDtDDDtDDDtDDDtDDDtDDDtDDDtD$""Bwwwwwwwwwwww"""""""""""""rwwww'w'"""wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww ""DGDDDGDDDGDD"""""""""""""ww'rw'r'"""DGDDDGDDDGDDDGDDDGDDDGDDDGDD""""""""""""rw'"rw"r'"""DGDDDGDDDGDDDGDDDGDDDGDDDGDD""""""""""""w"""r'""'"""DGDDDGDDDGDDDGDDwwwwwwwwwwww""""""""""""""""w'""w"""wwwwwwwwwwwwwwwwDDtDDDtDDDtD""""""""""""""""w"""r"""DDtDDDtDDDtDDDtDDDtDDDtDDDtD""""""""ppp""""""""'"""r"""DDtDDDtDDDtDDDtDDDtDDDtDDDtD""""""""""""""""'"""""""DDtDDDtDDDtDDDtDwwwwwwwwwwww""""""""""""""""""""""""wwwwwwwwwwwwwwwwDGDDDGDDDGDD""""""""""""""""""""DGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDD""""""""""""""""""""DGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDD""""""""""""""""""""DGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDDGDDwwwwwwwwwwww""""""""""""""""""""wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww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DDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDDDtDwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww333333333333333333333333553333553333333333333333333333333333AD@DDGtwDDtGDwDDQQQqawg3CD430@DtGDwDDtGDwDDDSSS333SSS3333333333000cwg333333333tDG@DtGttDtDtttDDwvff3tDG303@DDtttDtDtttDDD3555335553333333333030000vff633333333twD@DDGtwDGDGttDDQQUqdff3twD33@DDGttDGDGttDDD3SSU3SUS3333333333330000dff433333333tDD@DDGDttDtDttDDUUawFDD3tDD330@DtDtttDtDttDDD33UU3SU533333333333300000FDD633333333AD@DtwDtDDtwtGDDUUUAdff3CD433@DtwtGDDtwtGDDD3UUU3SUU53333333333333dff433333333D@DDDDDDDDDDDDDUDaADD33D3333@DDDDDDDDDDDDDD33U533U533333333333333333CDD333333333333333333333333333333333333333333333333333333333333333333333<-- title: l'habit erinthe -- author: Popolon popolon @ popolon.org -- desc: go out of Erinthe with friends -- site: popolon.org -- license: GPLv3 -- version: 0.1 -- script: lua m=math cos=m.cos sin=m.sin rnd=m.random abs=m.abs pi=m.pi pi2=m.pi*2 t=0 JMP=30 STR=20 DEBUG=false BLIT_SEG=0x3FFC PALETTE_MAP=0x3FF0 function bpp(b)poke4(2*BLIT_SEG,2^b)end function page(p)poke4(2*BLIT_SEG+1,p)end sprs={ ['heart']={s=992,col={0,4,7,3}}, ['gold']={s=994,col={0,6,4,7}}, ['sword']={s=995,col={0,7,6,4}}, ['staff']={s=999,col={0,4,2,1}}, ['hand']={s=996,col={0,6,4,7}}, ['shield']={s=998,col={0,3,7,1}}, ['shield2']={s=966,col={0,6,7,1}}, ['tomb']={s=960,col={0,3,2,7}}, } tools={ ["sword"]={spr={m=544,r=544,strd=3,col={0,7,2,3}},strklg=4,pwr=5}, ["staff"]={spr={m=608,r=608,strd=4,col={0,4,2,3}},strklg=5,pwr=2}, --["shield"]={spr={m=544,r=544,col={0,7,2,3}}} } plyr_df={ {spr=512,x=8,y=8,z=0,dir=0,mv=0,jmp=0, lv=5,hl=20,hlm=20,tool1=nil,tool2=nil,rl=r, strengthm=3,strengthM=5, magicm=1,magicM=2, col={0,1,5,6},lim={0,6,7,7},strklg=7}, {spr=576,x=8,y=8,z=0,dir=1,mv=0,jmp=0, lv=5,hl=20,hlm=20,tool1=nil,tool2=nil,rl=r, strengthm=2,strengthM=3, magicm=3,magicM=5, col={0,3,5,6},lim={0,6,7,7},strklg=7}, } plyr_btn={ {up=0,down=1,left=2,right=3,strike=4,jump=5,obj=6,invent=7}, -- for debug -- {up=0,down=1,left=2,right=3,strike=4,jump=5,obj=6,invent=7}, {up=8,down=9,left=10,right=11,strike=12,jump=13,obj=14,invent=15}, } plyr={} function pal_set(ps) poke4(PALETTE_MAP*2, ps[1]) poke4(PALETTE_MAP*2+1, ps[2]) poke4(PALETTE_MAP*2+2, ps[3]) poke4(PALETTE_MAP*2+3, ps[4]) end lvl={ {bg={0,0,32,16},col={0,4,2,7}, -- pos_start={ {x=8,y=8,dir=0}, {x=224,y=8,dir=1} }, pos_start={ {x=8,y=8,dir=0}, {x=224,y=8,dir=1} }, objs={ {"sword",t="weapon",v=5,x=24,y=8}, {"gold",t="gold",v=500,x=48,y=24}, {"shield",t="shield",v=5,x=56,y=80}, {"shield2",t="shield",v=5,x=72,y=80}, {"staff",t="weapon",v=5,x=128,y=8}, } } } lvl_cur={} function obj_ini(os) return {os[1],t=os.t,v=os.v,x=os.x,y=os.y} end function lvl_ini(i) lvl_cur={} lvl_cur={ref=lvl[i],bg=lvl[i].bg,col=lvl[i].col, pos_start=lvl[i].pos_start,objs={}} for j=1,#lvl[i].objs do lvl_cur.objs[j]=obj_ini(lvl[i].objs[j]) end for j=1,4 do p=plyr[j] if p ~= nil then p.x=lvl_cur.pos_start[j].x p.y=lvl_cur.pos_start[j].y p.dir=lvl_cur.pos_start[j].dir end end end function map_drw(l) pal_set(l.col) map(l.bg,0,0) for i=1,#l.objs do local o=l.objs[i] pal_set(sprs[o[1]].col) spr(sprs[o[1]].s,o.x,o.y,0) end pal_set({0,7,8,9}) -- test of gear -- spr(96+t%60//30,50,50,0) -- star(200+10*cos(t/50),80+5*sin(t/20),20) star(98,88,16) end function star(X,Y,R) local T=t/30 for i=0,pi2,pi2/10 do tri(X,Y,X+R*cos(i+T),Y-R*sin(i+T),X+R/2*cos(i+T+pi2/10),Y-R/2*sin(i+T+pi2/10),7) end circ(X,Y,R/4,0) end function bg_drw(l) map_drw(l) end function prtcl_smog_new(pt,x,y) local n=rnd(3,5) prtcls[pt].crct={my=y} prtcls[pt].elts={} for i=1,n do prtcls[pt].elts[i]={x=x+rnd(-2,2),y=y, t=rnd(10,15), dx=rnd(-1,1)/5, dy=rnd(-1,0)/10, s=rnd(0,5)/5, c=7} end end function prtcl_smog_upd(pt) for i=#prtcls[pt].elts,1,-1 do local p=prtcls[pt].elts[i] if p.t==0 then table.remove(prtcls[pt].elts,i) else p.x,p.y = p.x+p.dx,p.y+p.dy p.s=p.s+0.01 p.t=p.t-1 end end end function prtcl_smog_drw(pt) for i=1,#prtcls[pt].elts do p=prtcls[pt].elts[i] circ(p.x,p.y,p.s,p.c) end end function prtcl_acid_new(pt,x,y) local n=rnd(0,1) prtcls[pt].crct={my=y} prtcls[pt].elts={} for i=1,n do prtcls[pt].elts[i]={x=x+rnd(-2,2),y=y, t=rnd(30,50), dx=rnd(-1,1)/100, dy=rnd(-4,-1)/10, s=rnd(0,10)/5, c=2} --rnd(2,3)+4*rnd(0,1)} end end function prtcl_acid_upd(pt) for i=#prtcls[pt].elts,1,-1 do local p=prtcls[pt].elts[i] if p.t==0 then table.remove(prtcls[pt].elts,i) else p.dx=p.dx+rnd(-1,1)/100 p.x,p.y = p.x+p.dx,p.y+p.dy p.s=p.s+0.001 p.t=p.t-1 end end end function prtcl_acid_drw(pt) for i=1,#prtcls[pt].elts do p=prtcls[pt].elts[i] circb(p.x,p.y+1,p.s,p.c+3) circ(p.x,p.y,p.s,p.c) end end function prtcl_sang_new(pt,x,y) local n=rnd(5,10) prtcls[pt].crct={my=y} prtcls[pt].elts={} for i=1,n do prtcls[pt].elts[i]={x=x,y=y, t=rnd(30,50), dx=rnd(-5,5)/10, dy=rnd(-10,-5)/10} end end function prtcl_sangstrk_new(pt,x,y,h,dir) local n=rnd(15,20) prtcls[pt].crct={my=y} prtcls[pt].elts={} local min,max=3,8 if dir==0 then min,max = -max,-min end for i=1,n do prtcls[pt].elts[i]={x=x,y=h, t=rnd(30,50), dx=rnd(min,max)/10, dy=rnd(-3,3)/10} end end function prtcl_sang_upd(pt) for i=#prtcls[pt].elts,1,-1 do local p=prtcls[pt].elts[i] if p.t==0 then table.remove(prtcls[pt].elts,i) else p.dy=p.dy+0.1 if p.y+p.dy > prtcls[pt].crct.my then local tmp=p.dy/(prtcls[pt].crct.my-p.y) p.x=p.x+p.dx*tmp p.y=prtcls[pt].crct.my else p.x,p.y = p.x+p.dx,p.y+p.dy end p.t=p.t-1 end end if #prtcls[pt].elts==0 then table.remove(prtcls,pt) end end function prtcl_sang_drw(pt) for i=1,#prtcls[pt].elts do p=prtcls[pt].elts[i] pix(p.x,p.y,4) end end prtclt={ ['smog']={prtcl_smog_new, prtcl_smog_upd, prtcl_smog_drw}, ['sang']={prtcl_sang_new, prtcl_sang_upd, prtcl_sang_drw}, ['sangstrk']={prtcl_sangstrk_new, prtcl_sang_upd, prtcl_sang_drw}, ['acid']={prtcl_acid_new, prtcl_acid_upd, prtcl_acid_drw}, } prtcls={f=nil,elts={}} function particls_new(t,x,y,a,b) local pt=#prtcls+1 prtcls[pt]={t=t} prtclt[t][1](pt,x,y,a,b) end function particls_upd() for i=#prtcls,1,-1 do prtclt[prtcls[i].t][2](i) end end function particls_drw() for i=1,#prtcls do prtclt[prtcls[i].t][3](i) end end function perso_drw(p) if DEBUG then rect(p.x+p.lim[1], p.y+p.lim[2], p.lim[3]-p.lim[1], p.lim[4]-p.lim[2],2+t//2) rectb(p.x, p.y,8,8,4) print(val[1],p.x-10,p.y-10,7) print(val[2],p.x+12,p.y-10,7) print(val[3],p.x-10,p.y+12,7) print(val[4],p.x+12,p.y+12,7) end if (t%2)==1 then pal_set({0,1,2,3}) line(p.x,p.y+7,p.x+7,p.y+7,p.col[2]) end pal_set(p.col) -- trace("JMP="..10*math.sin(p.jmp*pi/JMP)) -- trace("p.y+7="..(p.y+7).." p.y-JMP"..(p.y-10*sin(p.jmp*pi/JMP))) if p.lv<=0 then local c=sprs["tomb"].col pal_set({c[1],p.col[2],c[3],c[4]}) spr(sprs["tomb"].s,p.x,p.y,0,1) elseif p.mv==1 then -- spr(1+t%60//30*2,x,y,14,3,0,0,2,2) spr(p.spr+t%20//10*2,p.x,p.y-10*sin(p.jmp*pi/JMP),0,1,p.dir) if p.tool1 ~= nil then pal_set(tools[p.tool1[1]].spr.col) spr(tools[p.tool1[1]].spr.m+t%20//10*2,p.x,p.y-10*sin(p.jmp*pi/JMP),0,1,p.dir) end else -- strike if p.str ~= 0 then spr(p.spr+3,p.x,p.y-10*sin(p.jmp*pi/JMP),0,1,p.dir) if p.tool1 ~= nil then pal_set(tools[p.tool1[1]].spr.col) spr(tools[p.tool1[1]].spr.r+3,p.x+tools[p.tool1[1]].spr.strd*(-2*p.dir+1),p.y-10*sin(p.jmp*pi/JMP),0,1,p.dir) end else -- rest spr(p.spr+t%60//30,p.x,p.y-10*sin(p.jmp*pi/JMP),0,1,p.dir) if p.tool1 ~= nil then pal_set(tools[p.tool1[1]].spr.col) spr(tools[p.tool1[1]].spr.r,p.x,p.y-10*sin(p.jmp*pi/JMP),0,1,p.dir) end end end if p.jmp>0 then p.jmp=p.jmp-1 if p.jmp==0 then particls_new('smog',p.x+4,p.y+8) sfx(1,'C-2')end end if p.str>0 then p.str=p.str-1 end pal_set({0,1,2,3}) end function perso_prox(p,o) --trace("p"..p.num..", o["..o[1].."]:") --trace ("ox-px:"..o.x-p.x.." px-ox:"..p.x-o.x) --trace ("oy-py:"..o.y-p.y.." py-oy:"..p.y-o.y) return (abs(o.x-p.x) < 8 or abs(p.x-o.x) < 8) and (abs(o.y-p.y) < 8 or abs(p.y-o.y) < 8) end function perso_release(p,tool) -- table.remove->add(lvl_cur.objs,i) -- {"sword",t="weapon",v=5,x=20,y=10}, local o=nil if tool ~= nil then if tool == 1 then o=p.tool1 p.tool1=nil elseif tool == 2 then o=p.tool2 p.tool2=nil end if o ~= nil then o.x=p.x+3-p.x%8 o.y=p.y+3-p.y%8 if DEBUG then trace("perso: p.x="..p.y..",p.y="..p.y) trace("release: o.x="..o.y..",o.y="..o.y) end lvl_cur.objs[#lvl_cur.objs+1]=o end end end function perso_get(p,o) if o == nil then perso_release(p,1) elseif o.t == "weapon" then if DEBUG then trace("p."..p.num.." get : "..o[1].." ("..o.t..")")end if p.tool1 ~= nil then perso_release(p,1) end p.tool1 ={o[1],t=o.t, v=o.v,o=o} elseif o.t == "shield" then if DEBUG then trace("p."..p.num.." get : "..o[1].." ("..o.t..")")end if p.tool2 ~= nil then perso_release(p,2) end p.tool2 ={o[1],t=o.t, v=o.v,o=o} elseif o.t == "gold" then if DEBUG then trace("p."..p.num.." get : "..o[1].." ("..o.t..")")end p.scr=p.scr+o.v end end function perso_weapon_dist(p,p2) if p.jmp==0 then if abs(p.y - p2.y) < 3 then --about y --naif if p.dir==0 then --toright local max=p.x+p.strklg local val=p.strPt if p.tool1 ~=nil then local T=tools[p.tool1[1]] max=max + T.spr.strd+T.strklg val=val + T.pwr end if p2.x+3 <= max and p2.x+p2.lim[3]-3 >= p.x+p.strklg then return val -- deep for compute spts? end else --toleft local max=p.x+p.lim[3]-p.strklg local val=p.strPt if p.tool1 ~=nil then local T=tools[p.tool1[1]] max=max - T.spr.strd-T.strklg val=val + T.pwr end if p2.x+p2.lim[3]-3 >= max and p2.x+3 <= p.x+p.lim[3]-p.strklg then return val -- deep for compute spts? end end -- *(-2*p.dir+1) 1 si droite -1 si gauche -- p.x+tools[p.tool1[1]].spr.strd*(-2*p.dir+1) end --else -- comp en height+jmp val end return nil end function perso_str(p) if p.str == 0 then if DEBUG then trace("p.str"..p.str)end p.str=STR sfx(0,'G-4') for i=#plyr,1,-1 do if i ~= p.num and plyr[i].lv>0 then --if () -- larger box to accelerage -- affinate with weapon local hit=perso_weapon_dist(p,plyr[i]) if hit~=nil then particls_new('sangstrk',plyr[i].x+plyr[i].lim[1],plyr[i].y+plyr[i].lim[2],plyr[i].y+plyr[i].lim[2]-3,p.dir) plyr_hit(plyr[i],hit) end end end end end function perso_jmp(p) if p.jmp == 0 then if DEBUG then trace("p.jmp"..p.jmp)end p.jmp=JMP end end function perso_ini(p,i) if DEBUG then trace("perso_ini ("..i..")")end p.num=i local I=plyr_df[i] p.ref=I p.spr=I.spr p.x=I.x p.y=I.y if DEBUG then trace("p.x="..p.x.." p.y="..p.y)end p.mv=0 p.lv=I.lv p.hlm=I.hlm p.hl=I.hlm p.jmp=0 p.str=0 p.strPt=rnd(I.strengthm,I.strengthM) p.strklg=7 p.mgcPt=rnd(I.magicm,I.magicM) p.scr=500 -- rnd(50,200) p.vict=false p.tool1=I.tool1 p.tool2=I.tool2 p.rl=I.rl p.col=I.col-- {0,1,5,6} --TODO generer les couleurs p.lim=I.lim end function perso_initpos(p) local i=p.num p.x=lvl_cur.pos_start[i].x p.y=lvl_cur.pos_start[i].y p.dir=lvl_cur.pos_start[i].dir p.z=0 p.mv=0 p.jmp=0 end function perso_looselife(p) perso_initpos(p) p.lv=p.lv-1 if p.lv > 0 then p.hl=p.hlm end end LVp=30 function score_drw() local X=0 for i=1,2 do P=plyr[i] X=(i-1)*120 -- background pal_set({0,1,2,3}) rect(X,128,120,8,P.col[2]) X=X+1 -- health if P.lv>0 then pal_set(sprs['heart'].col) spr(sprs['heart'].s+t%60//30,X,128,0) X=X+9 print(P.lv,X,129,0,true,1,true) X=X+4 pal_set({0,1,2,3}) rect(X,129,LVp+2,6,0) rect(X+1,129,P.hl*LVp/P.hlm,6,4) -- print("live:"..ply1.lv,1,130,0,true) print(string.format("% 3.f",P.hl).."/"..P.hlm,X+1,129,7,true,1,true) X=X+LVp+3 else local c=sprs["tomb"].col pal_set({c[1],P.col[2],c[3],c[4]}) spr(sprs["tomb"].s,X,128,0) X=X+9 X=X+4 rect(X,129,LVp+2,6,0) X=X+LVp+3 end -- tools if P.tool2 == nil then pal_set({0,P.col[3],0,0}) --sprs['hand'].col) spr(sprs['hand'].s,X,128,0,1,1) else pal_set(sprs[P.tool2[1]].col) --sprs['hand'].col) spr(sprs[P.tool2[1]].s,X,128,0,1,1) end X=X+9 if P.tool1 == nil then pal_set({0,P.col[3],0,0}) --sprs['hand'].col) spr(sprs['hand'].s,X,128,0) else pal_set(sprs[P.tool1[1]].col) --sprs['hand'].col) spr(sprs[P.tool1[1]].s,X,128,0) end X=X+8 -- gold print(string.format("% 8d",P.scr), X,129,0,true,1,true)X=X+32 pal_set(sprs['gold'].col) spr(sprs['gold'].s,X,127,0)X=X+8 end --test 2nd player end function scn_drw() cls(13) bg_drw(lvl_cur) for i=1,4 do if plyr[i] ~=nil then perso_drw(plyr[i]) end end particls_drw() score_drw() end function victory(p) p.scr=p.scr+1000 p.vict=true end function blocking(x,y) return mget(x,y)==1 end val={} function plyr_hit(p,val) p.hl=p.hl-val if p.hl < 0 then perso_looselife(p) end end function plyr_gnd(p) -- trace("p.num="..p.num) -- local val={} val[1]=mget((p.x+p.lim[1])//8,(p.y+p.lim[2])//8) val[2]=mget((p.x+p.lim[3])//8,(p.y+p.lim[2])//8) val[3]=mget((p.x+p.lim[1])//8,(p.y+p.lim[4])//8) val[4]=mget((p.x+p.lim[3])//8,(p.y+p.lim[4])//8) for i=1,4 do if val[i] == 2 and not p.vict then victory(p) end end if p.jmp == 0 then --- get penalties local acid=false for i=1,4 do if val[i] == 16 then acid=true end end if acid then plyr_hit(p,.1) if t%2 == 1 then particls_new('acid',p.x+4,p.y+8) end end local sang=false for i=1,4 do if val[i] == 18 then sang=true end end if sang then plyr_hit(p,.5) particls_new('sang',p.x+4,p.y+8) end end end function plyr_inp(i) local p=plyr[i] p.mv=0 if btn(plyr_btn[i].up) then p.mv=1 --up if not blocking((p.x+p.lim[1])//8,(p.y+p.lim[2]-1)//8) and not blocking((p.x+p.lim[3])//8,(p.y+p.lim[2]-1)//8) then p.y=p.y-1 end elseif btn(plyr_btn[i].down) then p.mv=1 --down if not blocking((p.x+p.lim[1])//8,(p.y+p.lim[4]+1)//8) and not blocking((p.x+p.lim[3])//8,(p.y+p.lim[4]+1)//8) then p.y=p.y+1 end end if btn(plyr_btn[i].left) then p.mv=1 p.dir=1 --left if not blocking((p.x+p.lim[1]-1)//8,(p.y+p.lim[2])//8) and not blocking((p.x+p.lim[1]-1)//8,(p.y+p.lim[4])//8) then p.x=p.x-1 end elseif btn(plyr_btn[i].right) then p.mv=1 p.dir=0 --right if not blocking((p.x+p.lim[3]+1)//8,(p.y+p.lim[2])//8) and not blocking((p.x+p.lim[3]+1)//8,(p.y+p.lim[4])//8) then p.x=p.x+1 end end if btnp(plyr_btn[i].strike) then perso_str(p)end --strike if btnp(plyr_btn[i].jump) then perso_jmp(p)end --jump if btnp(plyr_btn[i].obj) then if p.jmp == 0 then local O=nil for i=#lvl_cur.objs,1,-1 do if perso_prox(p,lvl_cur.objs[i]) then -- if DEBUG then trace("prox_ok:p("..p.num.."), perso_get:"..o[1].." value="..o.v)end O=i end end if O ~= nil then perso_get(p,lvl_cur.objs[O]) table.remove(lvl_cur.objs,O) else perso_get(p,nil) end end end --get/release -- if btnp(plyr_btn[i].invent) then perso_inventory(p)end --inventory plyr_gnd(p) end function BOOT() if DEBUG then trace("BOOT")end bpp(2) plyr[1]={} perso_ini(plyr[1],1) plyr[2]={} perso_ini(plyr[2],2) lvl_ini(1) end function TIC() if keyp(49)then DEBUG = not DEBUG end for i=1,4 do if plyr[i] ~= nil then plyr_inp(i)end end particls_upd() scn_drw() -- spr(1+t%60//30*2,x,y,14,3,0,0,2,2) if DEBUG then rect(0,0,8,32,0) if btn(plyr_btn[1].strike) then print('S',0,0,4) else print('S',0,0,7) end --strike if btn(plyr_btn[1].jump) then print('J',0,8,4) else print('J',0,8,7) end --jump if btn(plyr_btn[1].obj) then print('O',0,16,4) else print('O',0,16,7) end --jump if btn(plyr_btn[1].inv) then print('I',0,24,4) else print('I',0,24,7) end --jump print("dir="..plyr[1].dir,0,32,7) end for i=1,4 do if plyr[i]~=nil then if plyr[i].vict==true then print(i.." VICTORY!",24,54,0,true,4) print(i.." VICTORY!",20,50,7,true,4) end end end t=t+1 end