-
auto sprite = Sprite::create("HelloWorld.png"sv);
if (sprite == nullptr)
{
problemLoading("'HelloWorld.png'");
}
else
{
// position the sprite on the center of the screen
sprite->setPosition(Vec2(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y));
// add the sprite as a child to this layer
this->addChild(sprite, 0);
}
// add tortoise.c3b
auto modelc3b = MeshRenderer::create("tortoise.c3b");
modelc3b->setScale(0.2f);
auto s = Director::getInstance()->getWinSize();
modelc3b->setPosition( Vec2(s.width * 4.f / 4.f - 530, s.height / 2.f) );
// here second parameter od z_depth DOES NOT SENSE AT ALL I was triyng 0, -1, 1, -3, 3 ....
addChild(modelc3b,3)

screenshot here - https://github.com/axmolengine/axmol/assets/57157115/f84b9a47-0f7b-4356-b916-98b93cdc320f |
Beta Was this translation helpful? Give feedback.
Answered by
rh101
Feb 24, 2024
Replies: 2 comments
-
Doesn't that only affect the local Z ordering on a specific layer for 2D? The global Z value should work. Try |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
halx99
-
Yes this `setGlobalZOrder works ! Thankl you! You are very kind! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Doesn't that only affect the local Z ordering on a specific layer for 2D?
The global Z value should work. Try
setGlobalZOrder
.