我可以将CCMenu与CCMenuItemSprite一起添加到spritebatchnode吗?

时间:2012-09-17 15:18:24

标签: cocos2d-iphone ccsprite ccmenuitem

我可以将带有CCMenuItemSprite的CCMenu添加到spritebatchnode吗?

就这么简单。

代码段:

-(void) setUpPauseMenu
{
    CCMenuItemSprite *p = [CCMenuItemSprite itemWithNormalSprite:[CCSprite spriteWithSpriteFrameName:@"emptyCircle.png"] selectedSprite:[CCSprite spriteWithSpriteFrameName:@"emptyCircle.png"] target:self  selector:@selector(pauseGameScene)];

    p.position = CGPointMake(50.0f, 440.0f);
    p.anchorPoint = CGPointMake(0.5f, 0.5f);

    //[spritebatchnodereference addChild:p];
    **//CAN I ADD p TO SPRITEBATCHNODE?** 

    CCLabelTTF *pauseText = [CCLabelTTF labelWithString:@"II" fontName:@"Marker Felt" fontSize:20];
    pauseText.position = CGPointMake(22.0f, 28.0f);
    pauseText.anchorPoint = CGPointMake(0.5f, 0.5f);
    [p addChild:pauseText];

    //Create pause menu
    CCMenu *pauseMenu = [CCMenu menuWithItems: p, nil];
    pauseMenu.anchorPoint = CGPointMake(0.5f, 0.5f);
    pauseMenu.position = CGPointMake(50.0f, 440.0f);
    pauseMenu.visible=TRUE;
    [self addChild:pauseMenu];

}

1 个答案:

答案 0 :(得分:2)

没有

CCSpriteBatchNode仅接受CCSprite作为子级。