如何通过CCSpriteBatchNode替换CCSpriteSheet

时间:2012-04-23 19:02:21

标签: iphone ios cocos2d-iphone sprite

所以我创建了一个CCSpriteSheet

_spriteSheet = [[CCSpriteSheet spriteSheetWithFile:@"deuximages2.png" capacity:2] retain];
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"deuximages2.plist"];

另一种方法:

 mangeur = [CCSprite spriteWithSpriteFrameName:@"mangeurcentremieu_03.png"];

但是我有警告:CCSpriteSheet is deprecated.我认为我必须用CCSpriteBatchNode替换它,但我不知道该怎么做。

1 个答案:

答案 0 :(得分:2)

CCSpriteBatchNode的接口与CCSpriteSheet基本相同。我记得在0.99.5中引入CCSpriteBatchNode来替换CCSpriteSheet

_batchNode = [[CCSpriteBatchNode batchNodeWithFile:@"deuximages2.png" capacity:2] retain];