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}
- --initx = x-480/w -x*w math.floor((480-x)/w)
- --inity =
- 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)), #mapa do
- for b = math.max(1,-math.ceil(x/w)), #mapa[a] do
- if tonumber(mapa[a][b]) > 0 then stuff:setframe(tonumber(mapa[a][b])) stuff:blit(x+(b-1)*16,y+(a-1)*16) end
- end
- end
- screen.print(5,5,screen.fps().." "..math.abs(math.floor(x/16)))
- end
- while true do
- controls.read()
- blit_map(scroll.x,scroll.y,scroll.w,scroll.h)
- if controls.up() then scroll.y = scroll.y -1 end
- if controls.down() then scroll.y = scroll.y +1 end
- if controls.right() then scroll.x = scroll.x +1 end
- if controls.left() then scroll.x = scroll.x -1 end
- if controls.select() then a() end
- screen.flip()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement