1 decade ago by FelipeBudinich
It's just a small improvement, but I was on the brink of madness while developing my GUI/HUD and then I realized that I could use both Z_INDEX and POS_Y together to place those elements on top of everything.
(by the way, I wasn't able to inject this, anyone knows how?)
(by the way, I wasn't able to inject this, anyone knows how?)
ig.Game.SORT = {
Z_INDEX: function( a, b ){ return a.zIndex - b.zIndex; },
POS_X: function( a, b ){ return a.pos.x - b.pos.x; },
POS_Y: function( a, b ){ return a.pos.y - b.pos.y; },
// Can't understand how to inject this
POS_YZ: function( a, b ){ return (a.pos.y - a.zIndex) - (b.pos.y - b.zIndex); }
};
