This function can be used to randomise 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 2 generates the same initial random seed every time to make debugging code a far easier task. 要避免这种行为,请在游戏开始时使用随机化。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.
ds_grid_shuffle(index);
参数 | 描述 |
---|---|
index | The index of the grid to shuffle. |
N/A(无返回值)
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.