Z-order broken in current build?

I’m building against the latest source from GitHub and it appears that AddChild no longer supports z-order (rather, it takes the paramater, sets the internal field, but apparently ignores it)

auto sprite1 = Sprite::create("HelloWorld.png");
auto sprite2 = Sprite::create("CloseNormal.png");

// position the sprite on the center of the screen
sprite1->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
sprite2->setPosition(Vec2(visibleSize.width/2 + origin.x + 100, visibleSize.height/2 + origin.y));

// add the sprite as a child to this layer
this->addChild(sprite1, 4);
this->addChild(sprite2, 0);

sprite 1 should appear on front of sprite 2, but doesn’t,

Does anyone know of this is a deliberate change (i.e. is there now some other way of doing things), a bug (in which case how do I log it) or am I doing something daft :wink:

Since you’re on HEAD that is prob issue I found due to this PR:

which has now been fixed (though unmerged as of yet) in this PR:

Ahah! Thanks. This ‘bleeding edge’ testing is probably not good for my health!!

2 Likes

Just pulled latest from github and it is fixed.

:):grinning:

2 Likes