I want to order sprites in a specific layer order, but telling them all to…
go to (front) layer
go back (x) layers
… isn’t efficient. Is there a way I can set them to a specific layer? Or if the back layer has a specific layer ID (like 0), I could just do
warp
go to back layer
go back (-x) layers
how those functions work, if I’m not mistaken, is that it moves the order of the sprite in the StageMorph’s children. now, I don’t know why there isn’t a specific “put me in index _” for that, but it’s probably better to list the sprites ina. list, and starting from the first one tell each one to go to front.
I think this is what you want.
This also makes sense.
There isn’t an easy way to do it because the layers are just the order of the sprites, and you can run into issues if you don’t order them correctly. Take for example sprites A, B, C, D. I move C to layer 1 (C, A, B, D), D to layer 3, (C, A, D, B), and then A to layer 4 (C, D, B, A). As you can see, the layers kind of got messed up, because D was supposed to be on layer 3 but ended up on layer 2, and you wouldn’t even notice.
So the best way to guruntee the order is by doing what @bh said, and going through the sprites in the order you want them in and telling them to go to the back or front layer (tip: you can write it all in one script using the tell [ V] to ({} @>) @:> block).
You can get a list of all the sprites in layer order by asking the stage for