-
-
Notifications
You must be signed in to change notification settings - Fork 18
choose
Vašek edited this page Feb 7, 2019
·
11 revisions
Randomly choose given parameter
choose(params T[] items)
Argument | Description |
---|---|
params T[] items |
The variables to choose from |
Returns: T
This function will randomly return one of the given arguments (as many as are stated). The input values can be strings, integers, variables or constants. It is very useful when you want to spawn enemies in random angle or make randomized games with set attacks or moves.
NOTE: This function will return the same value every time the game is run due to the fact that SimplexRpgEngine generates the same initial random seed every time to make debugging code a far easier task. To avoid this behavior, use randomize()
at the start of your game.
image_angle = choose(0, 90, 180, 270);
This code will set an object's image_angle to one of four angles (in this case 0, 90, 180, or 270 degrees) on random when the event is called.
Back to number_functions