Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

move_random

drewmccluskey edited this page Feb 10, 2019 · 4 revisions

move_random

Sets a game objects position to a random position snapped to a defined grid

Syntax:

move_random(cellSize)
Argument Description
vector cellSize x and y grid cell to snap to

Returns: void

Description:

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.

Example:

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

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /