ds_grid_set_disk

Sets all the cells in a circular region in a grid to an indicated value.

Syntax:

GML Code Example

ds_grid_set_disk(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 set with the cells within the disk.


Returns: N/A


Description

With this function you can set a circular region of a grid to a certain value. You need to supply a starting grid cell (as an x and y axis coordinate) as well as the radius of the disk to set and the value that you wish to set the disk too, as shown by the illustration below:


Example:

GML Code Example

ds_grid_set_disk(grid, ds_grid_width(grid) div 2, ds_grid_height(grid) div 2, 5, -4);

The above code will set a circular region with a radius of 5 cells in the ds_grid indexed in the variable "grid" to a value of -4.





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