Greetings. I've tried to make a tilebased map drawer, but when I use it it makes the game lagg. Making a function that checks if the map was already drawn didn't work either. Is there something I can do to remove the lagg?
local posY = 0
for y = 1, map_screenH do
local posX = 0
for x = 1, map_screenW do
if map[y][x] > 0 then --]]
love.graphics.draw(tile[map[y][x]], 0 + posX, 0 + posY)
posX = posX + tile[2]:getWidth()
tempRect = HC:addRectangle(0, 0, 1, 1)
else
posX = posX + tile[2]:getWidth()
end
end
posY = posY + tile[2]:getHeight()
end
Thanks! I didn't notice it before now. I first made the for loop in love.load() to make the collision boxes and then copied it to draw to draw the tiles. I must have forgotten to remove that line.