GameMaker: Studio

GameMaker: Studio

View Stats:
supware Sep 2, 2017 @ 5:04am
Can I simulate a 3D array..?
Basically, I want to give objects 3 coordinates and then draw them in procedurally, via something like for(i=0;i<50;i++) for(j=0;j<50;j++) for(j=0;j<50;j++) {if tile[i,j,k] = 1 draw_sprite(...)}.

But I know tile[i,j,k] is an invalid expression. :/ does anyone know how to get around this problem??
< >
Showing 1-4 of 4 comments
Hm not sure if this would work but i'm pretty sure that you can make an array of arrays in gms...so basically you create a 2d array whose first part is the x coordinate and then the second part is another 2d array that is the y and z coordinate
Last edited by Soma; Sep 2, 2017 @ 6:42am
Blind Sep 2, 2017 @ 7:31am 
I've always found no need for 3D arrays, they're possible - but the lack of a negative dimension hurts their usability.
gartore Sep 2, 2017 @ 2:13pm 
the 3D array is basicaly a trio of arrays

why no use a 3 arrays of 1D? for the cordinates
Foxwarrior Sep 2, 2017 @ 2:55pm 
You can simulate any dimension of array with a 1D array, just use like tile[i*width*length+j*width+k] where width and length are variables/constants indicating the lengths of two of the sides of your desired 3D array.
< >
Showing 1-4 of 4 comments
Per page: 1530 50

Date Posted: Sep 2, 2017 @ 5:04am
Posts: 4