I just started using Phaser 3 and I am trying to figure out how to sort a Container with other sprites in a scene.
In Phaser 2, we can use groups to layer objects (which works great); however, group doesn’t work the same way in Phaser 3 and it seems that we need to use setDepth to layer objects as far as I know.
setDepth works great; but, when I add a sprite to a Container, the sprite / this child object’s depth is not working anymore.
Also, there is no way to set Container depth.
I am using Container to recreate an addChild to a sprite.
In Phaser 2, we can easily add a child object to another sprite; but, that is now gone from Phaser 3
For example, I want to create child objects that rotates around a parent object and using Container, it works great but the layering issue.
Anyone know a work around this?
I know I can manually layer the Container object at the correct layer by adding it in the scene manually at the right time. Matrixes / Math translations going to be too much and confusing LOL and I prefer not to go this route.
Also I know Container has sendToBack / bringToTop etc, but that means I have to somehow manually get all sprites on screen? and get their depth to compare with Container’s children’s; so then I can sort them manually by sendToBack / bringToTop etc?
I prefer if we are able to just use setDepth on Container object or perhaps the childrens’ depth work correctly.
Hopefully someone knows a work around to fix this issue, simpler solution which I hope Phaser 3 has.
Thanks.