This function can be used to get the alpha value of the background element. You give the background element ID (which you get when you create a background element using layer_background_create() or when you use the function layer_background_get_id()), and the function will return a value between 0 (fully transparent) and 1 (fully opaque).




参数 描述
background_element_id The unique ID value of the background element to get the information from


Real (from 0 to 1)


var lay_id = layer_get_id("Background_sky");
var back_id = layer_background_get_id(lay_id);
if layer_background_get_alpha(back_id) < 0.1

The above code will get the layer ID for the layer named "Background_sky" and then use that to get the ID of the background element on that layer. This ID is then used to check the element alpha and if it is less than 0.1, then the layer element is destroyed.

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