1 |
function tile_layer_depth(argument0, argument1) //gml_Script_tile_layer_depth |
2 |
{ |
3 |
var __depth = argument0 |
4 |
var __newdepth = argument1 |
5 |
var __layers = layer_get_all() |
6 |
var __numlayers = array_length_1d(__layers) |
7 |
__layerstomove[0] = -1 |
8 |
var __numlayerstomove = 0 |
9 |
var __layertouse = -1 |
10 |
var __i = 0 |
11 |
while (__i < __numlayers) |
12 |
{ |
13 |
var __layerdepth = layer_get_depth(__layers[__i]) |
14 |
if (__layerdepth == __depth) |
15 |
{ |
16 |
__layerstomove[__numlayerstomove] = __layers[__i] |
17 |
__numlayerstomove++ |
18 |
__i++ |
19 |
continue |
20 |
} |
21 |
else if (layer_get_depth(__layers[__i]) == __newdepth) |
22 |
{ |
23 |
__layertouse = __layers[__i] |
24 |
break |
25 |
} |
26 |
else |
27 |
{ |
28 |
__i++ |
29 |
continue |
30 |
} |
31 |
} |
32 |
if (__layertouse == -1) |
33 |
__layertouse = layer_create(__newdepth) |
34 |
for (__i = 0; __i < __numlayerstomove; __i++) |
35 |
{ |
36 |
var __els = layer_get_all_elements(__layerstomove[__i]) |
37 |
var __numels = array_length_1d(__els) |
38 |
for (var __j = 0; __j < __numels; __j++) |
39 |
{ |
40 |
if (layer_get_element_type(__els[__j]) == 7) |
41 |
layer_element_move(__els[__j], __layertouse) |
42 |
} |
43 |
} |
44 |
} |