Code questions
- Code:
function setup()
fors()
end
function draw()
background(50,50,50,255)
fill(150,200,100,255)
strokeWidth(2)
for a = 1,w do
for b = a,h do
rect(xX[a],yY[b],WIDTH/w,HEIGHT/h)
end
end
end
function fors()
h = 80
w = 100
xX = {}
yY = {}
for a = 1,w do
local x = WIDTH/w*a-WIDTH/w
table.insert(xX,x)
end
for a = 1,h do
local y = HEIGHT/h*a-HEIGHT/h
table.insert(yY,y)
end
end
Second question, if I bump up w to 1000 and h to 800, it won't draw the rectangles. I'm not sure why.
I'm just playing around with drawing lots of rectangles on an iPad and wondering if maybe I have terrible methods for drawing grids
viewtopic.php?f=33&p=21002#p21002