Page 1 of 1

for every 20 pixel draw picture?

Posted: Tue May 21, 2013 3:14 pm
by jjmafiae
its been awhile since ive had programmed lua and im making a game about space and i want it to draw a star for every 20 - 30 pixel how do i do that? :D

Re: for every 20 pixel draw picture?

Posted: Tue May 21, 2013 3:48 pm
by Larsii30
every 20 - 30 pixels..
You could use one or two for loops.

Code: Select all

function love.draw()
  for y = 1, love.graphics.getHeight() / 20 do
	for x = 1, love.graphics.getWidth() / 20 do
		love.graphics.rectangle( "fill", 20 * x, 20 * y, 5, 5 )
	end
	end
end
but this does not look like space at all :D
Maybe you want to set the positions randomly with math.random().

Re: for every 20 pixel draw picture?

Posted: Wed May 22, 2013 9:35 am
by jjmafiae
yes gonna look at it later thanks :D