Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stuff = image.loadsprite("stuff.png",16,16)
- dofile("mapa.txt")
- scroll={x=0,y=0,w=16,h=16}
- function blit_map(x,y,w,h)
- x,y,w,h = x or 0, y or 0, w or 16, h or 16
- for a = math.max(1,-math.ceil(y/h)), math.min(#mapa,272/h-y/h+1) do
- for b = math.max(1,-math.ceil(x/w)), math.min(#mapa[a],480/w-x/w+1) do
- if tonumber(mapa[a][b]) > 0 then stuff:setframe(tonumber(mapa[a][b])) stuff:resize(w,h) stuff:blit(x+(b-1)*w,y+(a-1)*h) end
- end
- screen.print(5,5,screen.fps().." "..x..":"..y.." - "..w..":"..h)
- end
- end
- while true do
- controls.read()
- blit_map(scroll.x,scroll.y,scroll.w,scroll.h)
- if controls.triangle() then scroll.h = scroll.h -0.5 end
- if controls.cross() then scroll.h = scroll.h +0.5 end
- if controls.circle() then scroll.w = scroll.w +0.5 end
- if controls.square() then scroll.w = scroll.w -0.5 end
- if controls.start() then scroll={x=0,y=0,w=16,h=16} end
- if controls.up() then scroll.y = scroll.y -2 end
- if controls.down() then scroll.y = scroll.y +2 end
- if controls.right() then scroll.x = scroll.x +2 end
- if controls.left() then scroll.x = scroll.x -2 end
- if controls.select() then a() end
- screen.flip()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement