This function will remove the given grid data structure from memory, freeing up the resources it was using and removing all values that it contained. This function should always be used when you are finished using the DS grid to prevent memory leaks that can slow down and crash your game.
NOTE You should always set the variable that held the data structure reference to -1 after calling this function, since the reference will no longer be valid.
ds_grid_destroy(index);
Argument | Type | Description |
---|---|---|
index | DS Grid | This index of the grid to destroy. |
N/A
if (lives == 0)
{
ds_grid_destroy(Wall_Grid);
Wall_Grid = -1;
room_goto(rm_Menu);
}
The above code will check the value of the built in global variable lives and if it is 0, it destroys the DS grid referenced in the variable Wall_Grid and then changes rooms.