Hello everybody,
I am trying to figure out what is the best technique to handle moving objects with shadows.
My problem is this:
I have several (potentially moving) objects. Each has its own image and a shadow image, in a display group.
The scene then adds these objects one after the other to its own view but since the last object added is on top of the previous objects (layering-wise), I end up with a situation where no matter what is the order I add things, I always end up with the shadow of one object being on top of the other object.
Here is an image to demonstrate:
On the right is the desired state. The other two are the two states I get - either ball shadow hides the object, or object shadow hides the ball.
I know I can first add all shadows, then all objects, but then I will have to add another piece of code to have the shadow follow the object, instead of just attaching the shadow to the same group as the object itself.
I was looking for a way to tell Corona that I want to assign specific images to a global layer - if this is possible, I believe it is the best option for my situation (so I will assign all shadows to layer 1, all objects to layer 2 etc).
Any tips on how to approach this would be appreciated.