VertexZ or zOrder

VertexZ or zOrder
0.0 0


Hello! I am new in cocos2d-x and now I have some problems with drawing my sprites in game. Please, tell me few word about VertexZ and zOrder. How it use and other information. Any help will be useful.
Thank you


VertexZ is the value used in OpenGL for z value. It is the distance between Object and camera.
zOrder is used in Node to determine the drawing sequence. It is invented by cocos2d-x.

zOrder is confused. We will rename it in future.


Okey, thank you. But I don’t understand how use it? I saw some example, but it’s hard for understand. On my map I have trees and some sprite. What values of zOrder or VertexZ must be?


If you want to use VertexZ, you should understand some concept of computer graphics knowledge.
zOrder is easy to understand. For example, there are tow node have the same parent. Then the node that has small zOrder will be drawn first.


Thank you


// tile height is 64x32 // map size: 30x30 auto p = _tamara->getPosition(); p = CC_POINT_POINTS_TO_PIXELS(p); float newZ = -(p.y+32) /16; _tamara->setVertexZ( newZ );
I find this code in samples. Can you explain me it? Please.