Two dimensional array

I dug this thread up from the grave cause i was looking for an answer, but it gave me an idea. Not sure why you need a 2D array so idk if this would work but I just thought of a way to address a linear array in a way that acts 2D. Have one int for x position one for y position, one for X length and one for Y length. Linear array’s total length should be (x length)*(Y length). Say your position is X3 and Y1, the theoretical grid size is 4 (0-3) on X and 4 (0-3) on Y. And assume the linear array starts at zero on the “lower left” corner. And the highest index represents the “top right” corner, with the array going “horizontally” along the theoretical grid. And advancing up a row when it reaches the right edge. So in this way to get an item at X column, Y row take ((PosY * SizeX) + PosX) to get the index in the array. In the above example (X3, Y1) it’d give you 7, for the index. Or the right most position on the second row from the bottom.