Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- imagen = {w = 15,h=15}
- imagen[1] = image.create(15,15,color.new(255,0,0))
- imagen[2] = image.create(15,15,color.new(0,255,0))
- mapa = {x = 0,actual = 1}
- mapa[1] = {
- {"1","2","2","2","2","2","2","2","2","2","2","1"},
- {"1","2","2","2","2","2","2","2","2","2","2","1"},
- {"1","2","2","2","2","2","2","2","2","2","2","1"},
- {"1","2","2","2","2","2","2","2","2","2","2","1"},
- {"1","2","2","2","2","2","2","2","2","2","2","1"},
- {"1","2","2","2","2","2","2","2","2","2","2","1"},
- {"1","2","2","2","2","2","2","2","2","2","2","1"},
- {"1","2","2","2","2","2","2","2","2","2","2","1"},
- {"1","1","1","1","1","1","1","1","1","1","1","1"}
- }
- mapa.y = -(#mapa[actual]*imagen.h)
- function mapa.blit()
- for y = 1, #mapa[actual] do
- for x = 1, #mapa[actual][y] do
- imagen[tonumber(mapa[actual][y][x])]:blit(mapa.x + (x-1)*imagen.w, mapa.y + (y-1)*imagen.h)
- end
- end
- end
- while true do
- controls.read();
- if controls.right() mapa.x = mapa.x +1 end
- if controls.left() mapa.x = mapa.x -1 end
- mapa.blit();
- if control.select() then broke(); end
- screen.flip();
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement