layer_background_get_id


描述

This function can be used to retrieve the unique ID value of the background element on a layer. You supply the layer ID (which you get when you use the layer name along with layer_get_id()) and the function will return the ID value associated with the background element on the layer. Note that this function is specifically designed for use with backgrounds that have been added in the IDE, as if you add a background to a layer through code using the function layer_background_create, then it will return the unique ID for the background element added.


语法:

layer_background_get_id(layer_id)


参数:

参数 描述
layer_id The unique ID value of the layer to target


返回:

Background element ID value (Real)


例如:

var lay_id = layer_get_id("Background_trees");
var back_id = layer_background_get_id(lay_id);
layer_background_sprite(back_id, bck_Trees_Winter);

The above code will get the layer ID for the layer named "Background_trees" and then use that to get the ID of the background element on that layer. This ID is then used to change the element sprite.


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