Exteme lagg when drawing tiles
Posted: Sun Dec 15, 2013 2:04 am
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?
Code that makes it lagg:
.rar archive of all the files: https://www.mediafire.com/?8c2pw9h9fm2szv7
.love file https://www.mediafire.com/?8c2pw9h9fm2szv7
Code that makes it lagg:
Code: Select all
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
.love file https://www.mediafire.com/?8c2pw9h9fm2szv7