MZ (solved but still open for ideas) Why is my z assignment in Sprite class not working?

Hey all,

So, I have two Sprites as children of one parent sprite. Then, I assign two different z values to them to define a priority, but until now, I cannot see any effect. I also tried swapping the numbers, but it's still that the sprite that I added second is shown above the one I added first.

My code looks like this:

Code:
// Sprite_Minimap_Layer derives from Sprite
Sprite_Minimap_Layer.prototype.initialize = function(...) {
  Sprite.prototype.initialize.call(this, ...);
  this.z = 5;
}

...

// some method to add the 2 Sprites
const sprite1 = new Sprite_Minimap_Layer(...);
const sprite2 = new Sprite_Minimap_Layer(...);
parentSprite.addChild(sprite1);
parentSprite.addChild(sprite2);
I believe "z" isn't a property used outside of Tilemap(maybe other places too, but that's where i know it comes from).

What you want to do is set the sortableChildren property to true to the container(inherited from Sprite which inherits it from PIXI.Sprite).

Then you can change the order of the sprites via the zIndex.
I'm not sure how this would work with a parent that has children.
Thanks for the tip.

I just ended up manually sorting the children array so that sprites with higher z values are put to the end.

Original thread: https://forums.rpgmakerweb.com/threads/solved-but-still-open-for-ideas-why-is-my-z-assignment-in-sprite-class-not-working.166973/