1

我可以将带有 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];

}
4

1 回答 1

2

不。

CCSpriteBatchNode 只接受 CCSprite 作为孩子。

于 2012-09-18T08:36:44.217 回答