I've got a level editor that has a bunch of layers that you can place objects in, and it all works fine. But then I scroll away and scroll back and layer 2 draws over all the other layers except for layer 7 (the very top layer). It SHOULD be drawing underneath every layer except layer 1 (in other words drawing in the order of whatever number it is).
No, no layer object. I'm not even really touching the layers at all, just placing objects on them.
I made sure to check the exact layer each object is on at run time, and I could find no pattern except for its consistently layer 2 that is being screwy.
Since you mentioned it, I think that I possibly have had something screwy happen on layer 2 for me, but that might just be a coincidence. I think all I did was continue to stuff around with events like 'bring to front' or 'move to layer' and 'move in front of object'.
Okay, after closer inspection it's not just layer 2. If I move everything on layer 2 'to back', then layer 3 just starts doing it.
I worked out a very good solution, but it requires sorting lists. I need a data structure that is capable of stable sorts (http://en.wikipedia.org/wiki/Sorting_algorithm#Stability ) (MagicDeque and Dynamic Array are both unstable) on 2-dimensional arrays. Does anyone know if one exists?