No no, I meant do it like this:
Your method requires only one variable. Imagine a 3 x 3 array is numbered like this:
If BoxPos was say 5, then by the above grid, it is stored in column 2, row 1. The array is a 3 x 3 grid. 5 Mod 3 = 2, the column number, and 5 / 3 = 1, the row number. Try it for other values of BoxPos to see how it works. However, this method is far slower and less natural than the one above - use the one with the X and the Y.
Ryan
; Assumes global X and Y ; Remember to check for moving outside of the array, ; and to include some sort of delay. Function moveblock() If KeyHit(KEY_RIGHT) array[X,Y] = 0 X = X + 1 array[X,Y] = 1 EndIf If KeyHit(KEY_LEFT) array[X,Y] = 0 X = X - 1 array[X,Y] = 1 EndIf If KeyHit(KEY_DOWN) array[X,Y] = 0 Y = Y + 1 array[X,Y] = 1 EndIf If KeyHit(KEY_UP) array[X,Y] = 0 Y = Y - 1 array[X,Y] = 1 EndIf End Function
Your method requires only one variable. Imagine a 3 x 3 array is numbered like this:
0 1 2
# # #
0 # 0 1 2
1 # 3 4 5
2 # 6 7 8
If BoxPos was say 5, then by the above grid, it is stored in column 2, row 1. The array is a 3 x 3 grid. 5 Mod 3 = 2, the column number, and 5 / 3 = 1, the row number. Try it for other values of BoxPos to see how it works. However, this method is far slower and less natural than the one above - use the one with the X and the Y.
Ryan