Gets the sum of all the values within a circular region. Only works when the cells are numbers.


GML Code Example

ds_grid_get_disk_sum(index, xm, ym, r);

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.

Returns: Real or String


This function can be used to add all the values all the cells found within the defined disk area of a grid together, as shown in the image below:


GML Code Example

val = ds_grid_get_disk_sum(grid, 5, 5, 2);

The above code will set the variable "val" to the sum of all values contained within the given disk of the ds_grid indexed in the variable "grid".

Back: DS Grids

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