cocos2dx 3.3 setGlobalZOrder对label没有作用

/**
     Defines the oder in which the nodes are renderer.
     Nodes that have a Global Z Order lower,are renderer first.
     
     In case two or more nodes have the same Global Z Order,the oder is not guaranteed.
     The only exception if the Nodes have a Global Z Order == 0. In that case,the Scene Graph order is used.
     
     By default,all nodes have a Global Z Order = 0. That means that by default,the Scene Graph order is used to render the nodes.
     
     Global Z Order is useful when you need to render nodes in an order different than the Scene Graph order.
     
     Limitations: Global Z Order can't be used used by Nodes that have SpriteBatchNode as one of their acenstors.
     And if ClippingNode is one of the ancestors,then "global Z order" will be relative to the ClippingNode.

     @see `setLocalZOrder()`
     @see `setVertexZ()`

     @since v3.0
     */
    virtual void setGlobalZOrder(float globalZOrder);

今天写代码,准备在最上层加一个label来显示分数,因为之前为了省事儿给好多node设置了GlobalZOrder,可是新添加的这个label一直被上层的node给挡住。

上网查了查才知道:

"Limitations: Global Z Order can't be used used by Nodes that have SpriteBatchNode as one of their censors."

class CC_DLL Label : public SpriteBatchNode,public LabelProtocol

Label是继承了SpriteBatchNode,所以Label设置setGlobalZOrder无效。

也没想到解决办法,还是去掉用的setGlobalZOrder吧。

相关文章

    本文实践自 RayWenderlich、Ali Hafizji 的文章《...
Cocos-code-ide使用入门学习地点:杭州滨江邮箱:appdevzw@1...
第一次開始用手游引擎挺激动!!!进入正题。下载资源1:从C...
    Cocos2d-x是一款强大的基于OpenGLES的跨平台游戏开发...
1.  来源 QuickV3sample项目中的2048样例游戏,以及最近《...
   Cocos2d-x3.x已经支持使用CMake来进行构建了,这里尝试...