|
Sometimes you will want to mix things up and surprise the player either by generating random numbers or choosing randomly. Choosing RandomlyChoosing randomly is best to choose randomly from a set of options, such as a random character class or random object. If you want to generate a number between a range, see Generating Random Numbers below. If you want to choose randomly between 16 or less selections, then you should probably use choose() instead of random(). choose() is better when used to select random names, messages or other strings and when the numbers to be chosen are not consecutive. Generating Random NumbersGame Maker has two functions and one action for generating things randomly. They are :
Using Random NumbersRandom SeedGame Maker cannot generate true random numbers because it is impossible for any computer to generate a truly random number. Instead, random numbers are generated by applying math to a seed number. Game Maker's random seed is set automatically when a game is loaded and there is no need to set the random seed before generating random numbers as with some game programming languages. However, if you ever want to generate the same set of random numbers, the functions below can help you. Random Position
Random Movement
Random SpeedRandom speed of an object :
Tutorials |
Related PagesActionsGML
Backlinks |
| Categories: Math : Random |