ds_grid_shuffle

Shuffles all the positions in a grid so that they end up in a random order.

Syntax:

GML Code Example

ds_grid_shuffle(index);


Argument Description
index The index of the grid to shuffle.


Returns: N/A


Description

This function can be used to randomize the positions of all values in all cells within a grid.

NOTE: This function will shuffle the grid cells to the same positions every time the game is run afresh due to the fact that GameMaker: Studio generates the same initial random seed every time to make debugging code a far easier task. To avoid this behaviour use randomize at the start of your game. This is only true when testing and debugging the game, as the final executable package will not show this behaviour and will be random every play.


Example:

GML Code Example

ds_grid_shuffle(grid);

This would take all the values in the ds_grid indexed in the variable "grid" and shuffle them around to get a different order.


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