layer_background_create


描述

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.


上一页: Background Layer Functions
next: layer_background_destroy
© Copyright YoYo Games Ltd. 2018 All Rights Reserved