Page 1 of 1

Exteme lagg when drawing tiles

Posted: Sun Dec 15, 2013 2:04 am
by 10100
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:

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
.rar archive of all the files: https://www.mediafire.com/?8c2pw9h9fm2szv7
.love file https://www.mediafire.com/?8c2pw9h9fm2szv7

[]

Posted: Sun Dec 15, 2013 2:30 am
by bekey
-snip-

Re: Exteme lagg when drawing tiles

Posted: Sun Dec 15, 2013 2:36 am
by 10100
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.