2
我是Android開發的初學者,一直在研究cocos2d-android中的遊戲並需要實現菜單屏幕。我看過谷歌,只能找到關於iPhone的cocos2d的信息。有人會對我如何添加菜單有任何建議/想法,或者更好地瞭解任何可以幫助我的教程或書籍?在Cocos2d-Android中創建菜單
在此先感謝!
我是Android開發的初學者,一直在研究cocos2d-android中的遊戲並需要實現菜單屏幕。我看過谷歌,只能找到關於iPhone的cocos2d的信息。有人會對我如何添加菜單有任何建議/想法,或者更好地瞭解任何可以幫助我的教程或書籍?在Cocos2d-Android中創建菜單
在此先感謝!
嗨,你可以使用CCMenu和CCMenuItemLabel在這裏使用CCMenu和CCMenuItemLabel創建菜單,我在這裏分享你一個例子,我從中選擇了菜單屏幕,所以它會對你有幫助,這裏給你展示使用CCMenu和CCMenuItemLabel所以儘可能地嘗試一下。
private CCNode addOtherOptions(String strName, int xpos, int ypos, String action) {
CCNode ccStartNode = CCNode.node();
ccStartNode.setPosition(CGPoint.ccp(xpos, ypos));
ccStartNode.setAnchorPoint(CGPoint.ccp(0, 0));
CCMenuItemLabel startGame = CCMenuItemLabel.item(strName, this, action);
startGame.setPosition(CGPoint.ccp(0, 0));
startGame.setAnchorPoint(CGPoint.ccp(0, 0));
startGame.setColor(ccColor3B.ccc3(139, 69, 19));
startGame.setScale(0.5f);
CCMenu menu2 = CCMenu.menu(startGame);
menu2.alignItemsVertically(-10f);
menu2.setPosition(CGPoint.ccp(-20, 0));
menu2.setAnchorPoint(CGPoint.ccp(0, 0));
// addChild(menu2);
ccStartNode.addChild(menu2);
return ccStartNode;
}