cseibert Posted August 15, 2018 Share Posted August 15, 2018 Is it possible to set a z-index or depth on images or sprites? I have an issue where I am dynamically generating sprites and they are overlaying on top of other things I don't want them to. Using sendToBack or bringToTop isn't an option due to I still need stuff as background and always on top. Right now i'm calling sendToBack and bringToTop on my background and foreground objects every time I create my new sprites. It would be nice if I could just do this.background.zIndex = 0, this.scoreText.zIndex = 100, and make everything else zIndex of like 50. Link to comment Share on other sites More sharing options...
Antriel Posted August 15, 2018 Share Posted August 15, 2018 `setDepth(depth)` (or `depth = ...`) can't be simpler, if you just searched for either z index or depth you would find it immediately http://labs.phaser.io/edit.html?src=src/depth sorting/Depth Sorting.js http://labs.phaser.io/edit.html?src=src/depth sorting/z index.js Link to comment Share on other sites More sharing options...
cseibert Posted August 15, 2018 Author Share Posted August 15, 2018 thanks! Link to comment Share on other sites More sharing options...
Recommended Posts