Using
Moai, how can you ensure one object appears over top of another? Maybe you need a starfield to appear under your ships, perhaps you want to see through a translucent window to objects behind a building, or maybe you just need a dialog button to appear over its background.
Most 3d games use a z-buffer to record the depth of each pixel rendered, and rely on a z-test so that pixels closer to the viewer can take precedence over pixels further away. Many 2d games, on the other hand, rely on rendering order to control which objects display over what. Every new object rendered simply overdraws ( or blends on top of ) whatever is currently on the screen.
In Moai, by default, it's rendering order that controls appearance. How, then, do you control the rendering order of objects? In what follows, I'll explain four techniques you can use to get your scenes rendering how you want...
See full post...