VertexZ [2]

VertexZ [2]
0.0 0


// 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.


maybe you could give some description where you got that and why you wanted to know, is it related to what you wanted to accomplish in your game or something?
It’s hard to comment without a proper context.
I can only guess maybe some z-ordering calculation…
-maybe there’s a shader or something
-there’s also a point to pixel conversion


I want know what means just this rows:
float newZ = -(p.y+32) /16;
It’s not my code, I have finded it in “samples”


the snippet means that as the character moves along the y axis (up and down), you want to change its z value, so that it can hide behind trees, but still block objects behind her


Ok, it’s means that if I want change my z value, I must use this code? And 32 and 16, it’s numbers depends on my tile’s size?