layer_background_xscale


描述

This function can be used to set the scale along the x-axis of a 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 then set the animation speed. The scale value you give is a multiplier that will be used to change the way the background element is displayed, where a value of 0.5 would display the element at half scale, and a value of 2 would display at double scale. Note that negative values are valid, and will "flip" the element around the (0,0) position, so an x scale of -1 would show the image reversed.


语法:

layer_background_xscale(background_element_id, xscale);


参数:

参数 描述
background_element_id The unique ID value of the background element to change
x轴缩放 The scale value to use (1 is no scaling)


返回:

N/A(无返回值)


例如:

var lay_id = layer_get_id("Background_water");
var back_id = layer_background_get_id(lay_id);
layer_background_xscale(back_id, -1);

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


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