1 |
function tile_set_depth(argument0, argument1) //gml_Script_tile_set_depth |
2 |
{ |
3 |
var __index = argument0 |
4 |
var __depth = argument1 |
5 |
var __layerid = layer_get_element_layer(__index) |
6 |
if (__layerid == -1) |
7 |
return -1; |
8 |
var __currdepth = layer_get_depth(__layerid) |
9 |
if (__currdepth == __depth) |
10 |
return -1; |
11 |
var __layers = layer_get_all() |
12 |
var __numlayers = array_length_1d(__layers) |
13 |
var __layertouse = -1 |
14 |
var __i = 0 |
15 |
while (__i < __numlayers) |
16 |
{ |
17 |
if (layer_get_depth(__layers[__i]) == __depth) |
18 |
{ |
19 |
__layertouse = __layers[__i] |
20 |
break |
21 |
} |
22 |
else |
23 |
{ |
24 |
__i++ |
25 |
continue |
26 |
} |
27 |
} |
28 |
if (__layertouse == -1) |
29 |
__layertouse = layer_create(__depth) |
30 |
layer_element_move(__index, __layertouse) |
31 |
return layer_get_depth(__layerid); |
32 |
} |