Velith Posted December 24, 2017 Share Posted December 24, 2017 Hi, First of all, I apologise for any mistakes in my english.EDIT (Solved) : I forgot to replace the "old" stage with the display one : app.stage = new PIXI.display.Stage(); and didn't notice the new 'layers' page http://pixijs.io/examples/#/layers/zorder.js (not http://pixijs.io/examples/#/display/zorder.js).My objective : I'm making an isometric game and I need to sort elements by Y coordinate. For instance, the player is moving and there is a tree : - I want to display the player after the tree when player.y > tree.y to make illusion that he is going IN FRONT OF the tree - And I want to display the player before the tree when player.y < tree.y to make illusion that is going BEHIND the tree. (I hope it's clear)Setup : Pixi v4.6.1, last pixi-layers.jsProblem : I made this before with pixi-display.js and i try to do the same now with pixi-layers.js but I fail to do it (even with the old one). => zIndex is not taking into account, only the initial order (insertion order) is used. // Create the layer const sortedLayer = new PIXI.display.Layer(); // Player sprite const player = new PIXI.Sprite(resources["player"].texture); player.x = ... player.y = ... player.parentLayer = sortedLayer; stage.addChild(player); // Tree sprite const tree = new PIXI.Sprite(resources["tree"].texture); tree.x = ... tree.y = ... tree.parentLayer = sortedLayer; stage.addChild(tree); // Try to change his displayOrder (without success) player.zIndex = 2; tree.zIndex = 1; sortedLayer.group.enableSort = true; // From wiki, but display : "undefined" and in fact i do not see this method in the pixi-layers.js console.log(sortedLayer.displayChildren); I use : https://github.com/pixijs/pixi-display to implement this code and there is a bonus question about the "layer.displayChildren" that is undefined Is there something missing or the documentation is not updated ? I try to use Pixi.Display.Group either but no success. I know there is : http://pixijs.io/examples/#/display/zorder.js and i try to do it but failed (Because I think I didn't use the "stage.displayList = new PIXI.DisplayList" i just see it right now... maybe there is something like that i missed too in my example ?) Thanks for your help ! Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.