Bentley
Member
Is there an easier way to store multiple values in one grid position than something like this:
When browsing this forum, I came across these ideas: set each grid position to an object, to an array, or to a ds list. I was just curious if there's an easier way. I'd imagine the above code gets pretty messy, especially when you need to add up several values a cell has. I'd imagine a ds_list for each position would be messy too, because that's a lot of lists to destroy. Is setting each ds_grid position to an object, and then using that object to store that position's values the best way to go?
I'm probably missing something obvious : ( Any ideas / suggestions are welcomed. Thanks for reading.
Code:
//Pseudocode
var grid_width = 10;
var grid_height = 10;
cell_type = ds_grid_create(grid_width, grid_height); //ds_grid of the cell's type
cell_h = ds_grid_create(grid_width, grid_height); //ds_grid of that same cell's h value
//etc. for other values I'd need the cell to have
for (var xx = 0; xx < grid_width; xx++)
{
for (var yy = 0; yy < grid_height ; yy++)
{
cell_type[# xx, yy] = NULL;
cell_h[# xx, yy] = point_distance(xx, yy, goal.x div CELL_SIZE, goal.y div CELL_SIZE);
}
}
I'm probably missing something obvious : ( Any ideas / suggestions are welcomed. Thanks for reading.
Last edited: