mp_grid_to_ds_grid

This function copies the given MP grid into a DS grid.

A cell in the DS grid will contain the value -1 if it's flagged as occupied in the MP grid, or 0 if it isn't.

NOTE To convert from MP grid to DS grid, see ds_grid_to_mp_grid.

WARNING The DS grid and MP grid must have the same width and height. If the grids' dimensions don't match, the conversion will fail and an error "Error, grid sizes do not match" is thrown.

 

Syntax:

mp_grid_to_ds_grid(source, destination);

ArgumentTypeDescription
sourceMP Grid IDIndex of the mp_grid that is to be used
destinationDS GridIndex of the ds_grid that is to be used to copy the grid data to.

 

Returns:

Boolean

 

Example:

motion_grid = ds_grid_create(room_width / 32, room_height / 32);
mp_grid_to_ds_grid(mp_grid, motion_grid);

The above code will create a new DS grid motion_grid and then copy the MP grid data contained in the variable mp_grid into the new DS grid.