`,]']>S}Wup8d%qy)6o;]AsVl3S}Wup8d%qy)6o;]AsVl3dppsiirp<=>i R@@@@PPSPPHLNbppXiIitLNi-;K+;KBA```````````BAAAACbqp0qpppibpcpq0qc::BAAC-.R:::::@@pV-=/iirprppppsppppppppIiXrppppqpstqps-R@@PP` "$p-LMN/imiprppppppqppppXiIbpppsrsrsBAAC-PPPP`p2#&&$rpqqqpppcipfppspppsrppsibpppperpps-.PPPPppBAAAAAAC234bppsirsipAACqprsHppcirppsrpcrpppppqp-.RPPPPrp ppppppps"$"#&&$rpeiirpqpppHrppIiXrsppCrppppppBAAAC"#$-.PPPP`qppppppsBC24E3%%F"&&&5&5&&$rcfbcbcbpppgpppppppHrsXiIirppspppppqrsrqp2349.R@@@PPP`qBpR@@@AACppqppprs24-/"&$=<=/rcrprppppsYBpppppppHiiiWVgpppppsrs-."&$89=PPPPPPPqsBqpPPP`psBAAAACpppppqf24 -./-.L NmL,Nm./bphpciH irppppppuHIiXiibpppps"&&%%F8 L PPPPPP`srpq@S```psppppps2%pqppppqqc24RS*+;K+-./-.LN.L,N.,,,,rpfhgppfiHigpp.....bppc::::bcirppqs;K+;K+2F%HLPPPPP`qrPPpppqpqpps2%%%pppqpppppcB@@@@@@@@@@@@@@@@@@@@@@PP@PP@PP@P@S:::::RPPP@@@PPPPPP0011111110rbpqpppppppppc`qppH<=>irppsrsi<=>rpps::::ACBAAAqsr%@@@@P@@PPARRRR::::@@A@@@@```psPP@@PS"&&&&$ppp`CBA`ppps2%%ppppppppsrPP`````PPPPPPPP`````PPPPPPPPPPPPPPPPPPPPPPPPPPPppc%%%p%qs..-m/ihIi-<=>/pppHLNiihLNIpsBCrqrsrqs8%PPPPPPPPPq``A```q`@``qqppPPPPP@@@`CF E`@SB`qqpppqPPPPPPPPpppppbcb``qpppq````````qqppq```````````````````````````pppp%%%ppcf.-I/iIhi-LMNbpppppppcbpc:::::::pCpppqq```````````pppppppppppppppppppppppppppppp```````qqqp`@@@@@@@ppppppppqqqqqppqpppB````````````ppppppppppppppppppppqpppppppppppppppppppppppppppppppppppppppppppcqppppqqqqqqqccbqqbsrpbpppppppppbqpqpppAqppqqpqppppppppppppp"&5$25&4"&5&$..Yhbppppppppppppppppppp"#####$2%2%%%#$"&$2m/4E%%%&&&&&$2-./4=>iYppVTp-/"#2%%##3F-./"&&&2./4-..../21-/4,N/ijikbpppcbppcTbpppppcp"5$"55$<=>"#$E3%"#$"&%%%33GD%F2%2./F-.<=>m%4E%-/4PPP`AC-/pststutpppppup24-...LN234D"&#$234"#$2%%%%%4"#$2G"#$2%%%$2./-..LN.%4E-/4```qps-/pbeWpppsTp2%4"#5#?#5#$-m/2%2%34-./234E%%%%%%%#$34-/234"&5&%%%42.."55%11111114-/4pV-/ptpppppppc.ppuUbp2%423%3?3%3F-./22%%4-./-./"#$D%%%34%4DG2%4"#$-...%F"<=E%%%FI XE%%%%%%-/4pbppppp-.rs rppppbpp2%42%F9XEGY-./2%"$-./-./-./2342%%%%%%F."#&#$-/-.42342%%%%%%ELNIImXh2-/4pppppppf-..<=>ppppTdppp"iii2%4-i.H4i-./"5555%4-/-/-/-/E%%%%%%G23%34-/-4-./2G X9hDLN88...YY..2-/4p.ppppppppppcjLNpp.pptppE&#$-/-.i111%4i-"&5&F ...-./-./-./-./-. ./.-.../-/2./-/R@P4=>(H25&5&$11111H=i11111%5555555p.psmrpstpppppu.ppcppD3%$"#55$.i%%%%Fi--..i...-./-./-./-./-../-.%4-/-./-./P``4NH2<=4H.iIhHmL,NmiIhH.i%.=. pp..derps<=1=>pppcUpp8-./23%%4"5#4UHTi--.111111111111111111 111111111111111.-.../-/-.BA````pq000H0LNm4HihIH.L,N.ihIHi%LNm. ppdpe.jLM1MNpppuTUpp"-.//2%%%%%%3FH1111U%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%11.../-/-.UWVHHLN.4H.iIhH11111iIhH.i000...p.pfbppppppppppppppu.gppE111F"%%%%%%F.mH%%%%U%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%f.-.../-/g-.TUHH00E000000000000000psrqp000ppppcpXk9...gdpp-./EF./iT..HbLNWrtpppqqppppppqpugfrtpqpppppqqpq%%cbppqe::::qqbqpqqqcqbqqqqcqqppcrqs.rcbs.rpsrpqs.rpsgppptppup000mjmjmjTbppp-./*+;-..10iBACrdecde<=rqpppppppppppeUgbeTrppppppppppp%%%pppuWtpsWVrpstpppturuVpppcf.m.V...m.WV..bpppjkjjkppppbppppppR@@@:::00000pfjVWVUL,NdppppppppppsVbpsUrpppppppppp%%%srsppppcqqqs::::rqbcccbqqbpppbpppppppppppppppsbppppppppppppppp`````ppppppppqqqcebddebdppppppppppppuTrpceUtppppppppppps"$"#$2423424"$-./24"555"#5#$-/2/ 23%34-./2/2%%%4-/"5/"&&#5&5##$-./"#$ ..23...334-/234.-.2%.....4-./2. "5$."&11...4-."5$2..-."&%4..."5&55&5&5$..2%%F2%%%%%%%%4"5&5###%%%..m........../2%%%333%%%.........../-...E%`A::::C......./-....%ppppqq`````AAAAAA11111111% N 10 ``L*H*K+J'E# C % HVTTWXXYYZZ[[[[[[\\\\\\\\\]]]]]sP][YX[[\\[[[[\]]\\\\]^^]]]]]]]]psvxz{}~ppp~pp`x{|~~~kni_g/egijkjhi3jAk@onooooooooooooooo #Pa #C##Pa #C# DD DD@D@D@D@DVc cc cc ccc06E EEE EEE E EE E eeeeeeeeeeeeeeeeeDp@Dp@h @@ ("""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""",0,]']>S}Wup8d%qy)6o;]AsVl3=#myAnim+1 then if myAnim.once then ps.frame=#myAnim else ps.frame=1 end end if ps.stats then for i=1,ps.hp do spr(299+gameTicks//8%2,ps.x+3+6*(i-1),ps.y-15,0) end end spr(myAnim[math.floor(ps.frame)],ps.x,ps.y-(ps.h-1)*8,0,1,ps.flip,0,ps.w,ps.h) if ps.frame==#myAnim then return true end end function ps.Collide(pa) for w=0,ps.w-1 do for h=-1,ps.h-2 do if w==0 and h==-2 then return false end if math.abs(pa.x-(ps.x+w*8))<7 and math.abs(pa.y-(ps.y+h*8))<8 then return true end end end return false end function ps.AddMove(px) table.insert(ps.lstStops,1,px) end function ps.Move() local mx=ps.lstStops[1] if math.floor(ps.x)==mx then ps.x=mx if #ps.lstStops==1 then ps.move=false end table.remove(ps.lstStops,1) elseif ps.x>mx then ps.x=ps.x-ps.speed elseif ps.x=#myAnim+1 then if myAnim.once then s.frame=#myAnim else s.frame=1 end end spr(myAnim[math.floor(s.frame)]+off,s.x,s.y,0,1,s.flip,0,s.w,s.h) if s.frame==#myAnim then return true end end table.insert(lstSprites,s) return s end function CreateWindow(px,py,pcolor,psmall,pstring,phead) local myWin={} myWin.msgW=print(pstring,0,-10,0,false,1,psmall) myWin.x=px myWin.y=py myWin.w=myWin.msgW+8 myWin.h=12 myWin.color=pcolor myWin.string=pstring myWin.delete=false myWin.head=phead or false myWin.small=psmall myWin.timer=10 function myWin.Draw() rect(myWin.x+2,myWin.y+2,myWin.w,myWin.h,15) rect(myWin.x,myWin.y,myWin.w,myWin.h,myWin.color) --print(myWin.string,myWin.x+4,myWin.y+6,0,false,1,true) local msgX=myWin.x+myWin.w/2-(myWin.msgW/2) local msgY=myWin.y+myWin.h/2-3 print(myWin.string,msgX,msgY,0,false,1,myWin.small) if myWin.head=="ork" then spr(492+math.floor((gameTicks/12)%2)*2,myWin.x+myWin.w+3,myWin.y+1,9,1,0,0,2,2) elseif myWin.head=="dragon" then spr(428,msgX+48,msgY-30,9,1,0,0,4,4) end end table.insert(lstWindows,myWin) return myWin end function CreateDoor(c,l) local D=CreateSprite("door") D.x=c*8+6 D.y=l*8 D.Img(269) D.h=2 D.flip=0 end function CreateTarget() target=CreateSprite("target") target.x=8* 4 target.y=8* 11 target.xA=0 target.xB=0 target.AddAnim("green",{288,289}) target.AddAnim("red",{290,291}) target.PlayAnim("red") target.create=false target.move=false target.t=0 end function CreatePlayer(sprNum) h=CreateSprite("hero") h.x=lvl[cLvl].startX h.y=lvl[cLvl].startY h.ox,h.oy=h.x,h.y h.vx=1/2 h.SPD=2 h.stpX=h.x*h.SPD h.stpY=h.y*h.SPD h.g=1 h.ladder=false h.num=sprNum h.key=false h.sword=false h.shield=false h.dead=false h.fight=false h.COOLD=12 h.coolD=h.COOLD h.AddAnim("walk",{256,257}) h.AddAnim("killed",{353,354,355,356,357},true) h.AddAnim("drown",{369,370}) h.AddAnim("shieldb",{276,277}) h.curAnim="walk" h.ground=false h.ladder=false h.wall=false return h end function CreateLadder(c,l,pTest) local test=pTest or false local delete=false local L={} local right =CheckSolid((c+1)*8,l *8) local left =CheckSolid((c-1)*8,l *8) local bottom=CheckSolid(c *8,(l+1)*8) L.c,L.l=c,l if right then if left then L.flip=2 return else L.flip=1 end elseif left then L.flip=0 else return end local nx,ny=c*8,l*8 local testWood=17 local count=wood+0 if test then count=testWood end for i=1,count do local S=CreateSprite(pTest or "ladder") if test then S.delete=true S.test=true testWood=testWood-1 else S.test=false wood=wood-1 end S.x,S.y=nx,ny S.Img(1) S.flip=L.flip%2 table.insert(L,S) if L.flip==2 then S.Img(2) nx=c*8 ny=l*8+i*8 else nx=c*8-i*4*(S.flip*2-1) ny=l*8+i*8 end -- test Collison local collision=false for m=1,#lstLadders do for n=1,#lstLadders[m] do local ld=lstLadders[m][n] if math.abs(S.x-ld.x)<8 and math.abs(S.y-ld.y)<8 then collision=true break end end end if CheckSolid(nx,ny,true) or CheckSolid(S.x,ny,true) or CheckSolid(nx-(L.flip*2-1)*4+L.flip*4,ny,true) or collision then break elseif wood==0 or S.x<8 or S.x>=226 then delete=true end end if test then return (17-testWood) end table.insert(lstLadders,L) if delete then DeleteLadder(L) end return wood end function DeleteLadder(pL) pL.delete=true for j=1, #pL do pL[j].delete=true if pL.test then pL[j].test=true end end end function ToggleLadder(s,pTest) local test=pTest or false local c,l=math.floor(s.x/8),math.floor(s.y/8) if CheckSolid(s.x,s.y) or CheckSolid(s.x,s.y-8) or s.x-8<0 or s.x+8>=240then return end local create=true for i=1, #lstLadders do local L=lstLadders[i] if L.c==c and L.l==l then if test then return end create=false DeleteLadder(L) end end if create then return CreateLadder(c,l,pTest) end return end function ClearSprites() for i=#lstSprites,1,-1 do local L=lstSprites[i] if L.delete then table.remove(lstSprites,i) if L.type=="ladder" and L.test==false then wood=wood+1 end end end for j=#lstLadders,1,-1 do if lstLadders[j].delete then table.remove(lstLadders,j) end end end function TargetState(s) if s.x<8 or s.x>=232 then target.PlayAnim("red") return elseif not CheckSolid(s.x,s.y-1) and not CheckSolid(s.x,s.y) then if CheckSolid(s.x-1,s.y)~=CheckSolid(s.x+8,s.y) then target.PlayAnim("green") return end end target.PlayAnim("red") end function Remap(tile,x,y) local outTile=tile if tile==240 or tile==224 or tile==208 or tile==192 or tile==196 or tile==176 or tile==180 or tile==212 or tile==228 or tile==244 then outTile=tile+(gameTicks/20)%4 elseif tile==109 then outTile=tile+(gameTicks/8)%2 elseif tile==11 then outTile=tile+(gameTicks/10)%3 elseif tile==16 then outTile=0 elseif goal and tile==14 then outTile=tFlag end return outTile end function RemapSprite(tile,x,y) if tile==16 then CreateLadder(x-camC,y-camY) elseif tile==6 or tile==8 then CreateDoor(x-camC,y-camL) end return 0 end function GetTile(x,y) local c=math.floor(x/8) local l=math.floor(y/8) return mget(c+camC,l+camL) end function CheckBoundaries(ps) if ps.x+2<0 or ps.x+6>239 or ps.y+1<0 then return true end return false end function CheckGoal() if GetTile(hero.x+4,hero.y)==14 and hero.x>4 then goal=true end end function CheckSolid(x,y,pWater) if fget(GetTile(x,y),1) then return true elseif pWater==true and fget(GetTile(x,y),2)then return true end return false end function CheckCollision(s) s.collide=false s.ladder=false if hero.dead then return end for i=#lstSprites,1,-1 do local S=lstSprites[i] if S.type=="key" then if math.abs(s.x-S.x)<4 and math.abs(s.y-S.y)<4 then PlaySound(S.type) S.delete=true hero.key=true OpenDoor() end elseif S.type=="sword" then if math.abs(s.x-S.x)<4 and math.abs(s.y-S.y)<4 then if s.sword==false then S.delete=true hero.sword=true end PlaySound(S.type) end elseif S.type=="shield" then if math.abs(s.x-S.x)<4 and math.abs(s.y-S.y)<4 then if s.shield==false then S.delete=true hero.shield=true end PlaySound(S.type) end elseif S.type=="ladder" then if math.abs(s.x-S.x)<4 and math.abs(s.y-S.y+1)<=7 then s.collide=true s.vy=1 if S.flip==s.flip then s.ladder=true s.vy=-1 return end end elseif S.type=="door" then if math.abs(s.x-S.x)<4 and math.abs(s.y-(S.y+(S.h-1)*8))<4 then s.flip=1-s.flip end elseif S.type=="grid" then if S.curAnim=="close" then if math.abs(s.x-S.x)<8 and math.abs(s.y-(S.y+(S.h-1)*8))<8 then s.flip=1-s.flip end end elseif S.type=="tele" then if math.abs(s.x-S.x)<1 and math.abs(s.y-S.y)<4 then Teleport(S,s) end elseif S.type=="lever" then if math.abs(s.x-S.x)<4 and math.abs(s.y-S.y)<4 then ToggleLever(S) S.lever=true else S.lever=false end elseif S.type=="switch" and S.curAnim=="open" then if math.abs(s.x-S.x)<1 and math.abs(s.y-(S.y+(S.h-1)*8))<4 then ToggleLever(S) end elseif S.type=="dragon" and S.dead==false then if S.Collide(s) then S.stats=true Fight(S) end if S.move==true then S.Move() end if S.coolD0 then ps.flip=1 else ps.flip=0 end end function ApplyGravity(s) if s.ladder==false then s.stpY=s.stpY+s.g*s.SPD end end function TryAgain() --when player get killed if nextTime==0 then BloodBath() StopMusic() local head="ork" local message="Ha ha ha !" if cLvl==#lvl then head="dragon" message="Need sword AND shield" end local w=print(message,0,0,0,true,1,true) local x=hero.x-(w+8+20)/2 local y=hero.y-24 if x>239-(w+30) then x=239-(w+20) end if x<1 then x=1 end if y<1 then y=1 end CreateWindow(x,y,12,true,message,head) end if nextTime==60 then scene="ready" else nextTime=nextTime+1 if nextTime<15 then hero.x=hero.x-math.floor(nextTime/10)*(hero.flip*2-1) end end end function Die(s,pAnim) s.sword=false s.shield=false s.PlayAnim(pAnim) s.dead=true attempt=attempt+1 end function BloodBath(ptype) -- generate particles end function ShieldBump(ps) local bx=ps.x for i=0,2 do bx=ps.x-(ps.flip*2-1)*8*i if CheckSolid(bx-(ps.flip*2-1)*8,ps.y) then if i==0 then hero.wall=true end break end end ps.x=bx end function Controls() -- cheatcode if btn(0) and btn(1) then goal=true end -- target controls --if not btn(0) and not btn(1) and not btn(2) and not btn(3) then target.t=0 end local moved=false if gameTicks==0 then moved=true end if btn(0) then moved=true if target.t==0 then target.y=target.y-8 elseif target.t>10 and target.t%4==0 then target.y=target.y-8 end target.t=target.t+1 if target.y<0 then target.y=0 end end if btn(1) then moved=true if target.t==0 then target.y=target.y+8 elseif target.t>10 and target.t%4==0 then target.y=target.y+8 end target.t=target.t+1 if target.y>128 then target.y=128 end end if btn(2) then moved=true if target.t==0 then target.x=target.x-8 elseif target.t>10 and target.t%4==0 then target.x=target.x-8 end target.t=target.t+1 if target.x<0 then target.x=0 end end if btn(3) then moved=true if target.t==0 then target.x=target.x+8 elseif target.t>10 and target.t%4==0 then target.x=target.x+8 end target.t=target.t+1 if target.x>232 then target.x=232 end end if btnp(4) or btnp(6) then moved=true ToggleLadder(target) elseif btnp(5) or btnp(7) then moved=true if lstLadders[1] then local L=lstLadders[1] DeleteLadder(L) end end ClearSprites() if moved==false then target.t=0 else local color=12 local msg="" spentWood=ToggleLadder(target,true) if spentWood then if spentWood<=wood then target.PlayAnim("green") else target.PlayAnim("red") color=2 end msg=spentWood.."/"..wood else target.PlayAnim("red") end infoBulle.Show(msg,100,color) end end function Fight(s) if not hero.fight then hero.fight=true PlaySound(s.type) else hero.coolD=hero.coolD-1 if hero.coolD==0 then if s.type=="orkSword" or s.type=="orkBow" then PlaySound(s.type) if hero.sword then s.delete=true hero.sword=false elseif hero.shield then hero.PlayAnim("walk") ShieldBump(s) else -- Bump(s) Die(hero,"killed") end elseif s.type=="dragon" then PlaySound(s.type) -- Bump(s) if hero.sword and hero.shield then s.x=math.floor(s.x)-4*(s.flip*2-1) hero.sword=false s.hp=s.hp-1 s.PlayAnim("hurt") s.coolD=s.coolD-1 if s.hp>0 then s.move=true --s.moveto=208 --(s.x-(s.flip*2-1)*8) s.AddMove(s.x-(s.flip*2-1)*8) hero.flip=1-hero.flip hero.fight=false else s.PlayAnim("die") s.dead=true --s.delete=true hero.sword=false hero.shield=false end else Die(hero,"killed") end end hero.coolD=hero.COOLD hero.fight=false end end end function AutoMove(ps) if ps.fight then return end if ps.wall then ps.stpX=ps.stpX-ps.flip*ps.SPD*2 ps.flip=1-ps.flip end if ps.ladder then if ps.wall then ps.stpX=ps.stpX-(ps.flip*2-1)/2 ps.flip=1-ps.flip else ps.stpX=ps.stpX+(ps.flip*2-1)/2 end ps.stpY=ps.stpY+ps.vy elseif not ps.ground and ps.wall then ApplyGravity(hero) else ps.stpX=ps.stpX+(ps.flip*2-1) end ps.x=math.floor(ps.stpX/ps.SPD) ps.y=math.floor(ps.stpY/ps.SPD) if fget(GetTile(ps.x,ps.y),2) then Die(ps,"drown") end if ps.y>136 then ps.dead=true end end function UpdateMenu() if attempt>1 then attempt=1 end if btnp(4) or btnp(5) then scene="ready" end end function DrawMenu() cls(0) print("Ladders & Dragons",20,47,2,-1,2) print("Press any button to start",48,80,14) end function UpdateReady() if not flushScreen then if goal and cLvl==#lvl then if btnp(4) or btnp(5) then cLvl=1 InitGame() scene="menu" return end else flushScreen=true flushTimer=0 end else if flushTimer < 30 then for i=0,16 do local s=CreateFlush() s.AddAnim("flush",{tFlush,tFlush+1,tFlush+2,tFlush+3}) s.AddAnim("unflush",{tFlush+3,tFlush+2,tFlush+1,tFlush,0}) s.PlayAnim("flush") --s.anim.flush.t=120 s.anim.unflush.t=4 s.x=flushTimer*8 s.y=i*8 end elseif flushTimer == 60 then lstWindows={} if goal then if cLvl<#lvl then cLvl=cLvl+1 else cLvl=1 end goal=false end local message="Level "..cLvl local win1=CreateWindow(96,56,12,false,message) message="Get Ready !" local win2=CreateWindow(170,HEIGHT*5/6,13,true,message,true) win2.h=10 elseif flushTimer==120 then for i=1,#lstFlush do local s=lstFlush[i] s.frame=1 s.PlayAnim("unflush") end InitGame() elseif flushTimer>=160 then --if btn(0) or btn(1) or btn (2) or btn(3) or btn(4) or btn(5) then InitGame() lstFlush={} scene="game" flushScreen=false --return --end end flushTimer=flushTimer+1 end DrawReady() end function DrawReady() cls() if cLvl>1 then DrawGame() end --if flushTimer>90 then --cls(0) --DrawGame() --end for i=1,#lstFlush do local s=lstFlush[i] s.Draw() end for i=1,#lstWindows do lstWindows[i].Draw() end end function UpdateGame() -- test GOAL & d34d if goal then nextTime=nextTime+1 if nextTime==120 then scene="ready" return end elseif hero.dead then TryAgain() --return else Controls() --TargetState(target) CheckWall(hero) CheckCollision(hero) AutoMove(hero) CheckGoal() end if not CheckGround(hero) and not hero.fight then ApplyGravity(hero) end ClearSprites() end function DrawGame() cls(0) map(camC,camL,30,17,camX,camY,0,1,Remap) for i=#lstSprites, 1, -1 do local s=lstSprites[i] s.Draw() infoBulle.Draw() --if s.collide then --rectb(hero.x,hero.y,8,8,11) --end end --WINDOWS ----- for i=1,#lstWindows do lstWindows[i].Draw() end --GOAL if goal then if cLvl==#lvl then rect(32,32,176,72,14) rectb(32,32,176,72,2) print("Last level clear !",72,50,12) print("THE END", 80,64,0,false,2) print("more to come...", 80,88,13) print("Soldier used... "..attempt, 82,96,3,true,1,true) else print("Level "..cLvl.." cleared !",73,51,15) print("Level "..cLvl.." cleared !",72,50,12) end end --debbug sScore="Ladders: "..wood.."/"..maxWood print(""..sScore,1,1,(gameTicks/10%2)+1) print(""..sScore,0,0,4) print("Level "..cLvl,0+1,6+1,1) print("Level "..cLvl,0,6,12) end function InitGame() goal=false hero={} nextTime=0 lstWindows={} lstSprites={} lstLadders={} lstTele={} maxWood=6 wood=maxWood spentWood=0 camC=(cLvl-1)%8*30 camL=(cLvl-1)//8*17 hero=CreatePlayer() boss={} CreateTarget() local toff=1 if hero.x>140 then toff=-1 end target.x=hero.x+8*(2*toff) target.y=hero.y+8*-1 map(camC,camL,30,17,camX,camY,0,1,RemapSprite) cls(2) for i=1,#lvl[cLvl] do local item=lvl[cLvl][i] CreateItem(item.type,item.c,item.l,item.id,item.curAnim) end gameTicks=0 PlayMusic(1) end InitGame() function TIC() --trace("-- "..gameTicks.." --",2) if scene=="game" then UpdateGame() DrawGame() elseif scene=="menu" then UpdateMenu() DrawMenu() elseif scene=="ready" then UpdateReady() end --local msg="boss.move: "..tostring(boss.move).." boss.x: "..boss.x --print (msg,100,0,12,false,1,true) gameTicks=gameTicks+1 end