-
-
Notifications
You must be signed in to change notification settings - Fork 18
move_random
drewmccluskey edited this page Feb 10, 2019
·
4 revisions
Sets a game objects position to a random position snapped to a defined grid
move_random(cellSize)
Argument | Description |
---|---|
vector cellSize |
x and y grid cell to snap to |
Returns: void
This function will move your GameObject to a random location in the room and then snap to the nearest grid cell based upon the vector size specified in the input. (0,0) will be a no-snap grid. This function is very useful when it comes to spawning enemies randomly or creating particle effects.
move_random(new Vector2(32,32));
The above code will move the current GameObject to a random position snapped to a 32x32 grid.
Back to Movement