簡體   English   中英

如何在cocos2d android中的另一個精靈上添加標簽或精靈?

[英]How to add label or sprite over another sprite in cocos2d android?

CCSprite butonSprite=CCSprite.sprite("magnet.png");
    CCLabel label1=CCLabel.makeLabel("START", "Arial", 30);
    label1.setPosition(0,0);
    butonSprite.addChild(label1);

    ccMacros.CCLOG("", ""+butonSprite.getChildren());

    CCMenuItemSprite item=CCMenuItemSprite.item(butonSprite, butonSprite,this,"goToGameScreen");
    CCMenu menu=CCMenu.menu(item);

僅精靈可見。 如何使標簽可見? 我嘗試將位置設置為標簽。

您的標簽可能在精靈的位置下方,請嘗試將z順序更改為大於sprite的z順序

例如

[sprite addChild:label z:10];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM