for every 20 pixel draw picture?

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
jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

for every 20 pixel draw picture?

Post 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
User avatar
Larsii30
Party member
Posts: 267
Joined: Sun Sep 11, 2011 9:36 am
Location: Germany

Re: for every 20 pixel draw picture?

Post 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().
jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

Re: for every 20 pixel draw picture?

Post by jjmafiae »

yes gonna look at it later thanks :D
Post Reply

Who is online

Users browsing this forum: No registered users and 73 guests