0,]']±>Sï}WÿÍu§ðp8·d%qy)6o;]ÉA¦ösï÷ôôô”°ÂVl†30 then print('Ramasse '..#items.g,45,3) spr(323,100,0,0) else print('Sort d\'ici',45,3) end if h.state=='dead' then print('GAME OVER',70,50,12,false,2) end end function _Uwin() t=t+1 end function _Dwin() circ(WIDTH/2,HEIGHT/2,t<50 and t or 50,2) cPrint('Bravo !!!',HEIGHT/2-5+1,0,2) cPrint('Bravo !!!',HEIGHT/2-5,12,2) end function testTile(p,tT,oX,oY,flip) local l,c flip=flip or p.flip l=p.x+oX+flip*tSize c=p.y+oY tile=mget(l//tSize,c//tSize) if isT(tile, tT) then return true end return false end function moveX(p,mx) if testTile(p,boundT,mx*tSize,0) or testTile(p,boundT,mx*tSize,tSize-1) then return false elseif testTile(p,grassT,tSize/2,0,0) then grassE.addPtcls(p.x,p.y) end p.x=p.x+mx*p.vX p.img=aStance("walk") --trace('move') p.m=true return true end function moveY(p,my) if (testTile(p,ladderT,2,tSize,0) and testTile(p,ladderT,tSize-3,tSize,0)) or (testTile(p,ladderT,2,tSize+my,0) and testTile(p,ladderT,tSize-3,tSize+my,0)) then p.x=(p.x+tSize/2)//tSize*tSize p.y=p.y+my*p.vL --trace('moveY') p.isLadder=true p.img=aStance("climb") p.m=true end end function isGround(p) if testTile(p,groundT,1,tSize,0) or testTile(p,groundT,tSize-2,tSize,0) then return true else return false end end function isGoal(p) if math.abs(p.x-eDoor.l*tSize)<0.5 and math.abs(p.y-eDoor.c*tSize)<0.5 then p.state='win' sfx(2) t=0 return true end return false end function isT(tile, list) for i=1,#list do if tile==list[i] then return true end end return false end function aStance(s) local frame=a[s].f[aT+1]+a[s].first return frame end function getItem(p) for i=#items.g, 1,-1 do local gX=items.g[i][1]*tSize local gY=items.g[i][2]*tSize if math.abs(p.x-gX)<=0.5 and math.abs(p.y-gY)<=0.5 then sfx(2,'B-6',-1,1,4,12) table.remove(items.g, i) if #items.g==0 then mset(eDoor.l,eDoor.c,33) end end end end function gravity(p) if isGround(p)==false and p.isLadder==false then if testTile(p,groundT,2,p.vY,0) or testTile(p,groundT,tSize-3,p.vY,0) then p.vY=0 p.y=(p.y+tSize/2)//tSize*tSize elseif p.vY<1 then p.vY=p.vY+G end else p.vY=0 end end function collision(p,f) for i=1,#foes do if math.abs(p.x-f.x)<=tSize/2-1 and math.abs(p.y-f.y)<=tSize/2-1 then sfx(3,-1,-1,3) p.state='dead' p.img=aStance("dead") end end end function cPrint(string,y,c,s) w=print(string,0,-1000,0,false,s or 1) print(string,WIDTH/2-w/2,y,c or 15,false,s or 1) end load() function TIC() _update(scene) _draw(scene) end -------------