layer_get_y


描述

You can use this function to retrieve the y position of the layer within the currently scoped room. 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 the function returns a real number for the x position of the layer, relative to the (0,0) position of the room. 默认为0.


语法:

layer_get_y(layer_id)


参数:

参数 描述
layer_id The unique ID value of the layer to get the y position of


返回:

Real(实数)


例如:

var lay_id = layer_get_id("Sprites");
if layer_get_x(lay_id) != 0 || layer_get_x(lay_id) != 0
    {
    layer_x(lay_id, 0);
    layer_y(lay_id, 0);
    }

The above code checks the given layer position and if it is not set to (0, 0) then it is set to that position.


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