The problem: I'm a dummy, and am missing something incredibly obvious.
Code: Select all
for rowIndex,row in ipairs(worldMap) do
for columnIndex,quadID in ipairs(row) do
local x,y = (columnIndex-1)*TileW, (rowIndex-1)*TileH
love.graphics.drawq(Tileset3, Quads1[quadID], x, y)
end
end
What I DON'T understand is how to make this work with a pseudo-camera system, so I can have arrays that draw larger than the screen size. I can't even figure out how to do a simple line of quads on its own. I can write out the logic, something like: " draw worldMap[cam.y][cam.x] to worldMap[cam.y + somelimit][cam.x + somelimit] " but no amount of looping makes that happen. I thought something like this would work:
Code: Select all
cam = { x = 0, y = 0} -- there are keypressed(keys) that alter these values
for i = 1,25 do
local x = (cam.x) * TileW -- TileW and TileH are defined elsewhere with the quads
local y = (cam.y) * TileH
local quadID = worldMap[cam.y + i][cam.x + i]
love.graphics.drawq(Tileset3, Quads1[quadID],x,y)
end
So: how do you do simple tile scrolling using drawq? What loop do I need to do something like " draw worldMap[cam.y][cam.x] to worldMap[cam.y + somelimit][cam.x + somelimit] " ?