Exteme lagg when drawing tiles

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
10100
Prole
Posts: 2
Joined: Sun Dec 15, 2013 1:56 am

Exteme lagg when drawing tiles

Post 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
bekey
Party member
Posts: 255
Joined: Tue Sep 03, 2013 6:27 pm

[]

Post by bekey »

-snip-
Last edited by bekey on Fri Jan 24, 2014 1:42 am, edited 2 times in total.
10100
Prole
Posts: 2
Joined: Sun Dec 15, 2013 1:56 am

Re: Exteme lagg when drawing tiles

Post 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.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 83 guests