Re: [library] gamera - A camera system for LÖVE - v1.0.1 is out
Posted: Sat Apr 02, 2016 4:18 am
I've got bump drawing the visible parts of my level, though it aint pretty.
I then use Gamera to split the level into two windows. Any tips on improving this mess would be a nice help.
Code: Select all
--Create Map
function createMap(bumpWorldRef)
wholeMap = {}
wholeMap[10000] = 0
rowIndex = 0
columnIndex = 0
for index=1, #mymap.layers[1].data do
if columnIndex == 40 then
columnIndex=0
rowIndex=rowIndex+1
end
local xpos = (columnIndex)*90
local ypos = (rowIndex)*30
wholeMap[index] = {index,xpos,ypos}
bumpworldRef:add(index,xpos,ypos,tileWidth,tileHeight)
columnIndex=columnIndex+1
end
end
--draw map
function levelUpdate(bumpworldRef)
local visibleItems, len = bumpworldRef:queryRect(0,0,800,600)
for i=1, len do
love.graphics.draw(tileset, Quads[mymap.layers[1].data[wholeMap[visibleItems[i]][1]]],wholeMap[visibleItems[i]][2],wholeMap[visibleItems[i]][3])
end