Color

Colors in Game Maker are stored as big-endian RGB triplets which correspond to values between 0 and 16777215 and make up the RGB color space. This means that besides using the built in constants, one can express colors as three bytes such that the bytes each represent a certain ammount of Red, Green or Blue in the color. Because Game Makers hexidecimal values use Big Endian encoding, colors can be thought of as comprising first the B color byte, followed by the G and then R. For instance, $FF0000 would make solid blue and $0000FF would make solid red. All hexidecimal values in Game Maker are preceded by the '$' character.

From this we can see that to choose a random color from the RGB color space, we can simply use the script:

// Returns an integer equal to 16777215 or less. return floor(random(16777216));

Colors in image editors are often represented by red, green and blue values. In order to translate these values to Game Maker, you can use the function make_color_rgb(red, green, blue). Each parameter should be between 0 and 255.

// Returns the value of corresponding to yellow return make_color_rgb(255,255,0);