With this function you can assign a sprite resource to a layer to be used as a background in your project. You supply the layer ID (which you get when you create the layer using layer_create()) or the layer name (as a string - this will have a performance impact) and a sprite index (which would be the name of the sprite as shown in the resource tree), and it will be added to the layer. The function returns the unique ID value for the element, which can then be used in further layer functions for backgrounds.
layer_background_create(layer_id, sprite)
参数 描述 layer_id The unique ID value of the layer to target (or the layer name as a string) sprite The sprite index to be used
Background element ID (Real)
global.back_layer = layer_create(10000);
global.back_trees = layer_background_create(global.back_layer,
spr_Trees);
The above code creates a new layer and then adds a new background element to it, setting a sprite to be the background image used.