zIndex not working?
Closed this issue · 3 comments
arakash92 commented
So I have two entities, a player and a sword.
Sometimes I need the sword behind the player, so I do:
swordEntity.zIndex = -10;
ig.game.sortEntitiesDeffered();
But it doesn't seem to do anything, what am I missing?
collinhover commented
Several things:
- you're sorting all layers with that call, use
ig.game.sortEntitiesDeferred( swordEntity.layerName );
instead - layers default to the game's sortBy method, have you changed that?
- can you check if this method is being called, and if so, what layer is passed to it: https://github.com/collinhover/impactplusplus/blob/master/lib/plusplus/core/game.js#L1453
arakash92 commented
I see. Well, I set the zIndex to -500 and it seemed to do the trick. =P
collinhover commented
That's strange. I haven't had any z index issues, but I'm not sure why -500 would make a diff. Reopen this issue if you figure out anything else.