So, here's my idea for a semi-three dimensional world:
Every object has an invisible "locator" object. This is the object that does the actual moving around and stuff. There are also two more objects: the shadow and the display object. The locator object has an instance variable called "Z," which is added to its Y position to determine the location of the display object. The shadow object simply looks for the first object below the display object (on the Z axis, mind you - not the Y axis) and displays there. Simple, right? Wrong.
For this to all render correctly, we have to sort the objects by Y and Z positions. If two objects have different Y values, the one with a higher Y displays in front of the other. This is fairly simple - assign each object a "ZOrder" instance variable and have the system go through each object by Z Order (ascending), sending each instance to the top of the layer as it does. Simple. But for the Z position, things get complicated. If two objects have different Z values, the same thing happens, except it overrides the previous value given if needed. But then, just using this system, we come across problems. If there are many, many objects, we see that some render incorrectly for a frame or two before being corrected by the system. This will not do. Plus, the sorting gets a little complicated when everything is the same object, but every instance has a variable or two determining its behavior and appearance. It's not the instance variables that are the problem, it's the fact that everything is an instance of the same object. Things get weird when we do this, so then everything has to have an "ID" variable, assigned either at the start of the layout or in the editor - possibly both - that we use to select it, which is much too complicated and will suck up memory faster than an industrial vacuum when using lots of objects.
So, you read that wall of text. Now, I have something to ask:
Could anyone help with the optimization of this? It will work, but it will be VERY (and I mean very) laggy if it does, so I need some way of optimizing it or just taking shortcuts while sorting. But ANYTHING will help.