get_bg_data

Returns the values of a custom stage’s specific background layer, using one of the following indexes:

Note that this only works on custom stages. Using this on a default stage will always return 0.

ArgumentTypeDescription
layer:realThe layer to check. Layers 1-6 are background, Layer 7 is ground level, and layers 8-9 are the foreground.
data:realThe data index to check. Can be one of the indexes listed above.

Example, called from a stage’s article1_update.gml:
//This will make the article's Y coordinate move at the same rate as the first background layer's Y-autoscroll speed.
y += get_bg_data(1, BG_LAYER_AUTOSCROLL_Y);