L
Lorp
Guest
I read that one can create nested arrays in gms2 with the following code:
var array = [[x1,x2,...],[y1,y2...]];
It works, however the syntax for calling a single point within a nested array does not work with any standard gml method. What is the syntax? I can't seem to find the documentation for this new gms2 feature.
I'm currently using two parallel lists (x's and y's) to store grid path coordinates and iterating through those values to convert it to pixel coordinates(the grid positions dynamically). It works well but it's allot of code and I would rather pass one array per path rather than two lists or 1d arrays. Furthermore, initializing non-linear constant paths is a huge chore with a standard 2d array because it has to be added one at a time.
example:
array[@ 0,0] = 1st x;
array[@ 0,1] = 2nd x;
array[@ 1,0] = 1st y;
array[@ 1,1] = 2nd y;
vs
array = [[1st x, 2nd x],[1st y, 2nd y]];
That is just for 2 positions. Imagine 20 or 30 positions in a predetermined erratic path or dynamically creating a new one.
Thanks in advance....
var array = [[x1,x2,...],[y1,y2...]];
It works, however the syntax for calling a single point within a nested array does not work with any standard gml method. What is the syntax? I can't seem to find the documentation for this new gms2 feature.
I'm currently using two parallel lists (x's and y's) to store grid path coordinates and iterating through those values to convert it to pixel coordinates(the grid positions dynamically). It works well but it's allot of code and I would rather pass one array per path rather than two lists or 1d arrays. Furthermore, initializing non-linear constant paths is a huge chore with a standard 2d array because it has to be added one at a time.
example:
array[@ 0,0] = 1st x;
array[@ 0,1] = 2nd x;
array[@ 1,0] = 1st y;
array[@ 1,1] = 2nd y;
vs
array = [[1st x, 2nd x],[1st y, 2nd y]];
That is just for 2 positions. Imagine 20 or 30 positions in a predetermined erratic path or dynamically creating a new one.
Thanks in advance....
Last edited by a moderator: