我在cocos2d 3.1中的cocos2d 3.0教程后遇到问题...编译完成时显示警告“CCSpriteBatchNode已弃用”,我现在如何使用plist?或者现在在cocos2d 3.1中没有使用?你能写一个例子,会非常有帮助:)
@implementation GameScene
{
CCSpriteBatchNode *_batchNode; // WARNING 1 HERE
Hunter *_hunter;
Bird *_bird;
}
-(void)addBackground
{
//1
CGSize viewSize = [CCDirector sharedDirector].viewSize;
//2
CCSprite *background = [CCSprite spriteWithImageNamed:@"game_scene_bg.png"];
//3
background.position = ccp(viewSize.width * 0.5f, viewSize.height * 0.5f);
//4
[self addChild:background];
}
-(void)createBatchNode {
//1
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"Cocohunt.plist"];
//2
_batchNode = [CCSpriteBatchNode batchNodeWithFile:@"Cocohunt.png"]; // WARNING 2 HERE
//3
[self addChild:_batchNode z:1];
}
答案 0 :(得分:0)
在3.1版中,重新制作cocos2d渲染器以自动批量绘制精灵。因此不再需要CCSpriteBatchNode,只需使用CCNode。
@implementation GameScene
{
CCNode *_batchNode; // WARNING 1 HERE
Hunter *_hunter;
Bird *_bird;
}