ds_grid_add_grid_region

This function can be used to add all the values of all the cells found within the source area of a grid to the values within the destination grid, as illustrated below:

DS grid add grid region

NOTE You can also use this function on the same grid to add values from one region of the grid to those stored in another (see code example below).

 

Syntax:

ds_grid_add_grid_region(index, source, x1, y1, x2, y2, xpos, ypos);

ArgumentTypeDescription
indexDS GridThe index of the destination grid.
sourceDS GridThe index of the source grid.
x1RealThe left position of the region of cells to copy from the source grid.
y1RealThe top position of the region of cells to copy from the source grid.
x2RealThe right position of the region of cells to copy from the source grid.
y2RealThe bottom position of the region of cells to copy from the source grid.
xposRealThe x position on the destination grid to add the source region to.
yposRealThe y position on the destination grid to add the source region to.

 

Returns:

N/A

 

Example:

ds_grid_add_grid_region(grid, grid, 0, 0, 1, 5, 2, 0)

The above code would copy the region of cells from (0,0) to (1,5) of the DS grid indexed in the variable "grid" and add them to the cells from position (2,0) of the same DS grid .