ds_grid_get

Returns the value of a cell in a grid.

Syntax:

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


Description

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.


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".


Back: DS Grids
Next: ds_grid_get_max
© Copyright YoYo Games Ltd. 2018 All Rights Reserved