background_index

The unique index of the image asset assigned to the background.

Syntax:

background_index[0...7];


Returns: Real


Description

As with most resources, backgrounds can be assigned and changed by setting their index to a different game asset. This array is what you must use to change any one of the 8 possible backgrounds (numbered form 0 - 7 within the array) that a room may have, or to get the index of any of those backgrounds. When setting it you should use the index of the included image asset from the background resources, or, if you have loaded a background into the game using background_add(), the variable where you have stored the loaded background index. The value array for any one of the backgrounds can be set to -1 to remove the background.


Example:

background_index[0] = choose(bck_Day, back_Evening, bck_Night);

The above code will set the background(0) index of the current room to be one of three possible background images from included the assets.


Back: Backgrounds
Next: background_visible
© Copyright YoYo Games Ltd. 2018 All Rights Reserved