I need a math wiz to solve this

I have a math problem I've been trying to solve. I don't even know if it is possible and if it is I don't have the math skills to solve it.

I am trying to spawn a grid of cells with multiple spawners and each cell needs to store its own row and column number in self attributes when it is spawned. I am trying to achieve this by using the X and Y axis positions of each spawned cell. This can be done with one spawner but the grid is 52 rows x 17 columns and spawning one at a time is very slow so I want to try it with multiple spawners. I also would like to spawn the cells with as few rules as possible to make it as fast as possible.

The row number is easy all the cells are the same height so a little formula will Identify its row number and pass it to a self attribute "(Start Position (1130) - self.Position.Y (1110)/self.Size.Height (20)". When the first cell in the column is spawned the result is 1 when the next cell is spawned it will equal 2 and so on. This won't work for the column numbers because the columns widths vary.

I have been trying to work something out in the attached spreadsheet. In;
Row 1 are the column numbers
Row 2 is the cell/column width
Row 3 is the X axis position for the cells in that column. The first column starts 10 pixels in from the edge of the screen so it's Pos X = 10 + (column width / 2)
Row 4 & 5 are my attempt to mathematically find the column number by its X position. A poor effort but about my level of math

I know all the x positions but passing them to a cell would require a lot of rules and attributes. I was hoping to use a formula in a Change Attribute action like the one for the rows.

Can someone say if this is even possible, have an idea how it can be done or a better way to do it? Any help would be greatly appreciated.

Comments

Sign In or Register to comment.