-- exemple par Vebveb. -- converti a la nouvelle syntaxe par Purobaz. local pix=graydraw.pixel local prt= graydraw.text local ligne= graydraw.line local wait=misc.wait local setcolor=graydraw.setcolor local SDECOR_SOL_GAUCHE = "\000\000?\ *UUÿ»\"ÿ÷ªÕª”kwŠõê•jU\000" local SDECOR_SOL = "\000\000ÿªªÿUUÿŽ*ÿ\000ºeªT«uŠu«UªU\000" local SDECOR_SOL_DROITE = "\000\000ü¨¨þTTÿ‹*ÿ\000»dªQ¯w‰v®U«W\000" local SDECOR_TERRE = "\000\000ªUªEºUªU¾T«UªUªT«UŠu«UªU\000" local SNUAGE_PETIT = "\000ÿ €*€*\000UÀ@\000\000Ààÿ €\000 À\000\000 €àÿ €\000\000Àÿ@@  €j€*@U\000" local SNUAGE_GROS = "\000\000 \r€*€\ \0005À_@\000 dà?\000\000@ð\000ˆ„øÿ€\000ð\000Àà?\000\000@Ð\000ð& €`\000" local map = {} local strmap = {"ZZZZZZ","ZZZZZZ","ZZZZZZ","ZZZZZZ","ZZZZZZ","ZZZZZZ","ZZZZZZ","ZZZZZZ","ZZZZZZ","ZZZZZZ","ZZZZZZ","ZZZZZZ","ZZZZZZZ","ZZZZZZZZ","ZZZZZZZZ","ZZZZZZZZ","ZZZZZZZZ","ZZZZZZZZZZZZ","ZZZZZZZ","ZZZZZZ","ZZZZZZ","ZZZZZZ","ZZZZ","ZZZZ","ZZZZ","ZZZZ","ZZZZZZZ","ZZZZZZZ","ZZZZZZZ","ZZZZZZZ","ZZZZZZZ","ZZZZZZ","ZZZZZZZ","ZZZZZZZ","ZZZZZZZ","ZZZZZZZZ","ZZZZZZZZ","ZZZZZZZZ","ZZZZZZZZ","ZZZZZZZZ","ZZZZZZZZ","ZZZZZZZZ","ZZZZZZZZ","ZZZZZZZZ","ZZZZZZZZ","ZZZZZZZZ","ZZZZZZZZ","ZZZZZZZP" } local igeneral = 8 local xdecal = 0 local descend=false local monte=false local forc = 0 local sprites = {SDECOR_TERRE,SDECOR_SOL_DROITE,SDECOR_SOL_GAUCHE,SDECOR_SOL,SNUAGE_PETIT,SNUAGE_GROS} local x,y -- local unpack=lib.unpack -- j'ai pas trouvé la fonction unpack, j'ai donc définie la mienne function unpack (t, i) i = i or 1 if t[i] ~= nil then return t[i], unpack(t, i + 1) end end local byte=string.byte local z local a,b,c,d,e,f,g,h local i,j,k,l,m,n,o,p local tete,pieds,gm,dt,gch local bas local ydescent=0 local hautact=1 function drawdep(depart) clear nil for x=1,121,8 do pushxspr x a,b,c,d,e,f,g,h= unpack(map[depart+((x-1)/8)],hautact,hautact+8) if(a and a<= 20) then drawspr 1, sprites[a] end -- équvalent à if(a~= nil and a<= 20) if(b and b<= 20) then drawspr 9, sprites[b] end if(c and c<= 20) then drawspr 17, sprites[c] end if(d and d<= 20) then drawspr 25, sprites[d] end if(e and e<= 20) then drawspr 33, sprites[e] end if(f and f<= 20) then drawspr 41, sprites[f] end if(g and g<= 20) then drawspr 49, sprites[g] end if(h and h<= 20) then drawspr 57, sprites[h] end end end local function rightscroll() a,b,c,d,e,f,g,h= unpack(map[igeneral+9],hautact,hautact+8) scrollx -2,0 --ligne(127,1,127,64) --blanc --ligne(128,1,128,64) xdecal = xdecal + 2 --if xdecal>8 then xdecal=xdecal-8 tout type de scroll if xdecal>=8 then xdecal=xdecal-8 -- notre scroll en particulier xdecal=10 x = 121-xdecal igeneral=igeneral+1 else x = 129-xdecal end pushxspr x if(a and a<= 20) then drawspr 1, sprites[a] end if(b and b<= 20) then drawspr 9, sprites[b] end if(c and c<= 20) then drawspr 17, sprites[c] end if(d and d<= 20) then drawspr 25, sprites[d] end if(e and e<= 20) then drawspr 33, sprites[e] end if(f and f<= 20) then drawspr 41, sprites[f] end if(g and g<= 20) then drawspr 49, sprites[g] end if(h and h<= 20) then drawspr 57, sprites[h] end end local function leftscroll() scrollx 2,0 xdecal = xdecal - 2 if xdecal < 0 then xdecal=6 end x = 1-xdecal pushxspr x a,b,c,d,e,f,g,h= unpack(map[igeneral -7],hautact,hautact+8) if(a and a<= 20) then drawspr 1, sprites[a] end if(b and b<= 20) then drawspr 9, sprites[b] end if(c and c<= 20) then drawspr 17, sprites[c] end if(d and d<= 20) then drawspr 25, sprites[d] end if(e and e<= 20) then drawspr 33, sprites[e] end if(f and f<= 20) then drawspr 41, sprites[f] end if(g and g<= 20) then drawspr 49, sprites[g] end if(h and h<= 20) then drawspr 57, sprites[h] end end local function downscroll(force) -- force entre 1 et 4 if force == 8 then scrolly -4,0; scrolly -4,0 else scrolly (-force),0 end y = 65-(force) bas= hautact+8 z,a,b,c,d,e,f,g,h = map[igeneral -7][bas],map[igeneral -6][bas],map[igeneral -5][bas],map[igeneral -4][bas],map[igeneral -3][bas],map[igeneral -2][bas],map[igeneral -1][bas],map[igeneral][bas],map[igeneral +1][bas] i,j,k,l,m,n,o,p= map[igeneral +2][bas],map[igeneral +3][bas],map[igeneral +4][bas],map[igeneral +5][bas],map[igeneral +6][bas],map[igeneral +7][bas],map[igeneral +8][bas],map[igeneral +9][bas] if(z and z<= 20) then pushxspr 1-xdecal ; drawspr y, sprites[z] end if(a and a<= 20) then pushxspr 9-xdecal ; drawspr y, sprites[a] end if(b and b<= 20) then pushxspr 17-xdecal ; drawspr y, sprites[b] end if(c and c<= 20) then pushxspr 25-xdecal ; drawspr y, sprites[c] end if(d and d<= 20) then pushxspr 33-xdecal ; drawspr y, sprites[d] end if(e and e<= 20) then pushxspr 41-xdecal ; drawspr y, sprites[e] end if(f and f<= 20) then pushxspr 49-xdecal ; drawspr y, sprites[f] end if(g and g<= 20) then pushxspr 57-xdecal ; drawspr y, sprites[g] end if(h and h<= 20) then pushxspr 65-xdecal ; drawspr y, sprites[h] end if(i and i<= 20) then pushxspr 73-xdecal ; drawspr y, sprites[i] end if(j and j<= 20) then pushxspr 81-xdecal ; drawspr y, sprites[j] end if(k and k<= 20) then pushxspr 89-xdecal ; drawspr y, sprites[k] end if(l and l<= 20) then pushxspr 97-xdecal ; drawspr y, sprites[l] end if(m and m<= 20) then pushxspr 105-xdecal ; drawspr y, sprites[m] end if(n and n<= 20) then pushxspr 113-xdecal ; drawspr y, sprites[n] end if(o and o<= 20) then pushxspr 121-xdecal ; drawspr y, sprites[o] end if(p and p<= 20) then pushxspr 129-xdecal ; drawspr y, sprites[p] end end local function upscroll(force) if force == 8 then scrolly 4,0; scrolly 4,0 else scrolly (force),0 end y = -7+force bas= hautact-1 z,a,b,c,d,e,f,g,h = map[igeneral -7][bas],map[igeneral -6][bas],map[igeneral -5][bas],map[igeneral -4][bas],map[igeneral -3][bas],map[igeneral -2][bas],map[igeneral -1][bas],map[igeneral][bas],map[igeneral +1][bas] i,j,k,l,m,n,o,p= map[igeneral +2][bas],map[igeneral +3][bas],map[igeneral +4][bas],map[igeneral +5][bas],map[igeneral +6][bas],map[igeneral +7][bas],map[igeneral +8][bas],map[igeneral +9][bas] if(z and z<= 20) then pushxspr 1-xdecal ; drawspr y, sprites[z] end if(a and a<= 20) then pushxspr 9-xdecal ; drawspr y, sprites[a] end if(b and b<= 20) then pushxspr 17-xdecal ; drawspr y, sprites[b] end if(c and c<= 20) then pushxspr 25-xdecal ; drawspr y, sprites[c] end if(d and d<= 20) then pushxspr 33-xdecal ; drawspr y, sprites[d] end if(e and e<= 20) then pushxspr 41-xdecal ; drawspr y, sprites[e] end if(f and f<= 20) then pushxspr 49-xdecal ; drawspr y, sprites[f] end if(g and g<= 20) then pushxspr 57-xdecal ; drawspr y, sprites[g] end if(h and h<= 20) then pushxspr 65-xdecal ; drawspr y, sprites[h] end if(i and i<= 20) then pushxspr 73-xdecal ; drawspr y, sprites[i] end if(j and j<= 20) then pushxspr 81-xdecal ; drawspr y, sprites[j] end if(k and k<= 20) then pushxspr 89-xdecal ; drawspr y, sprites[k] end if(l and l<= 20) then pushxspr 97-xdecal ; drawspr y, sprites[l] end if(m and m<= 20) then pushxspr 105-xdecal ; drawspr y, sprites[m] end if(n and n<= 20) then pushxspr 113-xdecal ; drawspr y, sprites[n] end if(o and o<= 20) then pushxspr 121-xdecal ; drawspr y, sprites[o] end if(p and p<= 20) then pushxspr 129-xdecal ; drawspr y, sprites[p] end end local compteurg = {5,6,7,8} local compteurd = {7,6,5,8} local function vagauche() igeneral=igeneral-1 for i=1,4,1 do state true leftscroll() state false if (key(41) and tete and tete>=20 and pieds<20) then monte=true compteur = compteurg[i] end if descend then ydescent=ydescent+2 if ydescent == 8 then downscroll(8); state (false);ydescent=0 ;hautact=hautact+1 ;descend=false else downscroll(ydescent) end elseif monte then compteur=compteur-1 ydescent=ydescent+2 if ydescent >= 8 then ydescent=ydescent-8;upscroll(8); state(false) ;hautact=hautact-1 else upscroll(ydescent) end if compteur <= 0 or not tete or tete<20 then monte=false compteur =0 ydescent=0 end end --prt(9,1,xdecal) --prt(9,9,igeneral) pushxspr 57 drawspr 33, SDECOR_TERRE pushxspr 57 drawspr 41, SDECOR_TERRE refresh end end local function vadroite() map[igeneral+10]={byte(strmap[igeneral+10],1,-1)} map[igeneral-15]=nil for i=1,4,1 do state true rightscroll() state false if (key(41) and tete and tete>=20 and pieds<20) then monte=true compteur = compteurg[i] end if descend then ydescent=ydescent+2 if ydescent == 8 then downscroll(8); state (false);ydescent=0 ;hautact=hautact+1 ;descend=false else downscroll(ydescent) end elseif monte then compteur=compteur-1 ydescent=ydescent+2 if ydescent >= 8 then ydescent=ydescent-8;upscroll(8); state(false) ;hautact=hautact-1 else upscroll(ydescent) end if compteur <= 0 or not tete or tete<20 then monte=false compteur =0 ydescent=0 end end --prt(9,1,xdecal) --prt(9,9,igeneral) pushxspr 57 drawspr 33, SDECOR_TERRE pushxspr 57 drawspr 41, SDECOR_TERRE refresh end end function fin() prt(10,10,"Tu es mort") refresh wait(100) misc.exit() end --on modifie la map --maptemp = {} for i=1,17,1 do map[i]={byte(strmap[i],1,-1)} end setcolor(true) drawdep(1,1) refresh state false repeat --state true --if(key(37)and map[igeneral-17]~=nil) then --leftscroll(hautact) --elseif (key(40) and map[igeneral+1]~=nil) then --rightscroll(hautact) --end --if(key(39)) then --forc=forc+1 --elseif (key(38)) then --forc=forc-1 --end --state false --if forc <=-4 then downscroll(hautact,4);state (false);forc=forc+4 ;hautact=hautact+1 --elseif forc >=4 then upscroll(hautact,4);state(false);forc=forc-4 ;hautact=hautact-1 end --if forc <0 then downscroll(hautact,-forc) --elseif forc >0 then upscroll(hautact, forc)end state true gm=map[igeneral-8] gch=map[igeneral-1][hautact+5] dt=map[igeneral+1][hautact+5] pieds=map[igeneral][hautact+6] tete=map[igeneral][hautact+3] if pieds==nil then fin() elseif (pieds>=20) and not monte then descend=true end if key(37) and gm~=nil and gch>=20 then vagauche() elseif key(40) and dt>=20 then vadroite() else if descend then ydescent=ydescent+2 if ydescent == 8 then downscroll(8); state (false);ydescent=0 ;hautact=hautact+1 ;descend=false ; else downscroll(ydescent) end elseif (key(41) and tete and tete>=20 and pieds<20) then monte=true compteur = 8 end --saut descend=false if monte then compteur=compteur-1 ydescent=ydescent+2 if ydescent >= 8 then ydescent=ydescent-8;upscroll(8); state(false) ;hautact=hautact-1 else upscroll(ydescent) end if compteur <= 0 or not tete or tete<20 then monte=false compteur =0 ydescent=0 end end pushxspr 57 drawspr 33, SDECOR_TERRE pushxspr 57 drawspr 41, SDECOR_TERRE refresh end until key(36)