Bentley
Member
I have a dumb question, but, oh well, I'll look silly. Lets say I create a ds_grid and set every position to be a pointer for an array:
I know I can access the pointer for the array and the values for that array like so:
Is there a way to use the pointer directly from the grid? These obviously don't work, but this is what I had in mind.
Code:
global.grid = ds_grid_create(COLS, ROWS);
for (var xx = 0; xx < COLS; xx++)
{
for (var yy = 0; yy < ROWS; yy++)
{
global.grid[# xx, yy] = [EAST, WEST, SOUTH, NORTH];
}
}
Code:
var a = global.grid[# 0, 0]; // Store the pointer for the array at grid position 0,0
show_message(a[0]); // EAST
show_message(a[1]); // WEST
show_message(a[2]); // SOUTH
show_message(a[3]); // NORTH
Code:
show_message(global.grid[# 0, 0].[0]);
show_message(global.grid[# 0, 0][0]);
Last edited: