ds_grid_value_disk_y

Finds the y position of a value found within a circular region of a grid.

Syntax:

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


Argument Description
index The index of the grid.
xm The x position of the disk on the grid.
ym The y position of the disk on the grid.
r The radius of the disk on the grid.
val The value to find.


Returns: Real


Description

With this function you can get the y coordinate (within the given grid disc-shaped region) of the value being searched for. Be aware that if the value being searched for does not exists, the function will return 0, so it is a good idea to check if the values exists first with ds_grid_value_disk_exists then run this function (along with the ds_grid_value_disk_x function) to get the exact position within disc being searched.


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.


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