Draw Squares (SOLVED)

In my game I want a lot of white squares but I don’t want it to lag so I draw them:

local function dot(self,size,pos)
	for i = -size, size do
		local spos = vmath.vector3(pos.x + i, pos.y - size, 0)
		local epos = vmath.vector3(pos.x + i, pos.y + size, 0)
		msg.post("@render:", "draw_line", { start_point = spos, end_point = epos, color = vmath.vector4(1, 1, 1, 1) } )
	end
end

function update(self, dt)
local s = 14
	for i = 1, s do
		dot(self,i,vmath.vector3(50,50*i ,0))
	end
end

It looks fine on the Computer:


But On Mobile something is wrong:
The Lines dont scale. Can someone send me a better solution for this problem or fix this so it will work on all devices without lagging.

Use sprites; cheaper, faster and no lag.

4 Likes

ok I will try.

Works!

1 Like