pixijs / layers

Separate the z-hierarchy of your scene tree from its canonical structure.
https://pixijs.io/layers/docs/
MIT License
222 stars 57 forks source link

Children are not visible #1

Closed kaansoral closed 8 years ago

kaansoral commented 8 years ago

Hi

So I've just started using pixi-display, first thing I noticed is that the children of a sprite are not directly visible, they are invisible, I should probably give them a displayGroup too, however, I think shouldn't need to

Any ideas?

kaansoral commented 8 years ago

Hmm

"all objects that don't have displayGroup are added in "displayChildren" list of first parent that has it a displayGroup."

For me, I have to manually set a .displayGroup, or the child is not visible

Edit: Also thanks for the awesome plugin, after 10 minutes of using it, I love it, tho I manually added .displayGroup adoption to 1-2 places, luckily I don't have many unique sprite types yet

ivanpopelyshev commented 8 years ago

@kaansoral that's a bug. Can you make me a small demo?

kaansoral commented 8 years ago

Here you go:

    var bunny = new PIXI.Sprite(texture_green);
    var bunny2 = new PIXI.Sprite(texture_green);bunny2.width=25; bunny2.height=25;
    bunny2.x=-50; bunny2.y=-50;
    //bunny2.displayGroup = greenLayer;
    bunny.addChild(bunny2);

http://pixijs.github.io/examples/index.html?s=display&f=zorder.js&title=Z-order&plugins=pixi-display&v=

Append this to the demo, if the commented out part stays commented out, the small bunnies are not visible

ivanpopelyshev commented 8 years ago

Ok, i see the stupid bug. gona update the lib

ivanpopelyshev commented 8 years ago

All done, all is working, please check it.

kaansoral commented 8 years ago

Thanks, updated, works great :)

When I explicitly set the displayGroup of the child, the order from the parent seemed random, sometimes the child appeared on top, sometimes bottom, didn't pay attention too much

However, as far as I observe, it's always on the front now, as expected