Jump to content

rectangle jump line


Fabioxps

Recommended Posts

13 minutes ago, Fabioxps said:

I am making an inventory each line of this inventory has 6 rectangles how can I make a function to detect every 6 rectangles skip a line and draw the next 6 below

Hello Fabioxps,

what have you coded so far? Can you share it with us?

Link to comment

sorry for my bad English I am Brazilian come on.

 

local tabela = {
	[1],
  	[2],
  	[3],
  	[4],
  	[5],	
  	[6],
  	[7]
}


for i=1 #tabela do
  dxDrawRectangle()
end

each 6 items in the table the next ones will be created in a new line

Edited by Fabioxps
Link to comment
51 minutes ago, Fabioxps said:

sorry for my bad English I am Brazilian come on.

 


local tabela = {
	[1],
  	[2],
  	[3],
  	[4],
  	[5],	
  	[6],
  	[7]
}


for i=1 #tabela do
  dxDrawRectangle()
end

each 6 items in the table the next ones will be created in a new line

Np, here is an idea:

local row = math.floor(i / 6);
local column = ( i % 6 );

Then you can multiply row with pixel height, column with pixel width of rectangle.

  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...