Returns the value of a cell in a grid.


GML Code Example

ds_grid_get(index, x, y);

Argument Description
index The index of the grid.
x The x position of the cell you want to find the value of.
y The y position of the cell you want to find the value of.

Returns: Real or String


This function can be used to get the value (either a real number or a string) from any cell within the given ds_grid. If you pass invalid grid coordinates to the function, then the value returned will be 0.


GML Code Example

var xx, yy;
 xx = irandom(ds_grid_width(grid) - 1);
 yy = irandom(ds_grid_height(grid) - 1);
 val = ds_grid_get(xx, yy);

The above code selects a random cell from the ds_grid indexed in the variable "grid" and stores its value in the variable "val".

No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here