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:
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);