This function can be used to get the unique instance ID of the given instance element. You give the instance element ID (see the code example below for how to get this), and the function will return a real value that represents the unique instance id for the element. If the element is not an instance, the function will return -1.




参数 描述
element_id The unique ID value of the instance element to get the ID of


Real (Unique ID value for an instance)


elements = layer_get_all_elements("Instances");
for (var i = 0; i < array_length_1d(elements); i++)
     if (layer_get_element_type(elements[i]) == layerelementtype_instance)
        var layerelement = elements[i];
        var inst = layer_instance_get_instance(layerelement);
        inst.x = inst.x + 10;

The above code will check get all the instance elements on a layer, then get their unique ID value and use that to move them 10px to the right.

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