Recommended Posts

Hello ! as you can see in the photo , drawing rectangles in 4 lines and max of rectangle by line are 6

i just want know how to draw the rectangles like that for example like in the image 4 lines & max by line 6

Those are individual rectangles put next to eachother. Download guieditor, make a rectangle, copy it, paste it, put it next/under the previous one. Done.

Edit: Can also make the script add them using simple math.

Edited by Forthwind
1 hour ago, Forthwind said:

Those are individual rectangles put next to eachother. Download guieditor, make a rectangle, copy it, paste it, put it next/under the previous one. Done.

Edit: Can also make the script add them using simple math.

i won't by guieditor .... i want add them by using math but idk how

This test code will draw 12 rectangle one next one !!

i want it draw the rectangle in 4 lines and every line has 3 rectangle , so 3x4=12 !! any one can help me ?

```local test = {

{"aaaaa",100},
{"xxx",100},
{"qqq",100},
{"dsqd",100},
{"dsqdqsd",100},
{"dsqdqsd",100},
{"dsqdqsd",100},
{"dsqdqsd",100},
{"dqsdsqd",100},
{"dsqdqsdsqd",100},
{"dsqdqsdqs",100},
{"dsqdqsdq",100},

--12

}
for i, v in ipairs (items) do
dxDrawRectangle ( 500+i*50,400,50,50 tocolor ( 0, 0, 0, 150 ) )
end
end)```

You can use a loop inside another loop.
1 loop for rows and the other for columns.

```local cols,rows = 4,6
local size = 45
local space = size + 5

for row=0,rows-1 do
for col=0,cols-1 do
dxDrawRectangle( 10+(space*row), 300+(space*col), size, size )
end
end
end )```

Or instead of calculating the positions in real-time you can store it in a table then draw them.

Edited by Mr.Loki

Create an account

Register a new account