ds_grid_value_disk_x

With this function you can get the x coordinate (within the given grid disc-shaped region) of the value being searched for. You give the DS grid index (as returned by ds_grid_create()) along with the x/y positions for the center cell of the disk. Then you give the radius (as an integer value) around the center cell to search, before supplying the value to search for. If the value being searched for does not exist, then the function will return -1.

 

Syntax:

ds_grid_value_disk_x(index, xm, ym, r, val);

ArgumentTypeDescription
indexDS GridThe index of the grid.
xmRealThe x position of the disk on the grid.
ymRealThe y position of the disk on the grid.
rRealThe radius of the disk on the grid.
valAnyThe value to find.

 

Returns:

Real

 

Example:

if (ds_grid_value_disk_exists(grid, 5, 5, 5, val))
{
    xpos = ds_grid_value_disk_x(grid, 5, 5, 5, val);
    ypos = ds_grid_value_disk_y(grid, 5, 5, 5, val);
}

The above code checks a ds_grid for a specific value within a disk region. if it is found, it then stores the x and y position of the value in two variables for later use.