Animation Cocos2D精灵动画批处理节点故障
我得到以下错误:Animation Cocos2D精灵动画批处理节点故障,animation,cocos2d-iphone,Animation,Cocos2d Iphone,我得到以下错误:“CCSprite没有使用相同的纹理id” 这就是我正在做的: .h file @interface GameplayLayer : CCLayer <GameplayLayerDelegate> { CCSpriteBatchNode* pointbb; } .m file pointbb = [CCSpriteBatchNode batchNodeWithFile:@"pointsbb.png"]; [self addChild:pointb
“CCSprite没有使用相同的纹理id”
这就是我正在做的:
.h file
@interface GameplayLayer : CCLayer <GameplayLayerDelegate> {
CCSpriteBatchNode* pointbb;
}
.m file
pointbb = [CCSpriteBatchNode batchNodeWithFile:@"pointsbb.png"];
[self addChild:pointbb];
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"pointsbb.plist"];
CCSprite* spa = [CCSprite spriteWithSpriteFrameName:@"poi2500001.png"];
[pointbb addChild:spa];
.h文件
@界面游戏层:CCLayer{
CCSpriteBatchNode*pointbb;
}
.m文件
pointbb=[CCSpriteBatchNode batchNodeWithFile:@“pointsbb.png”];
[self addChild:pointbb];
[[CCSpriteFrameCache sharedSpriteFrameCache]addSpriteFramesWithFile:@“pointsbb.plist”];
CCSprite*spa=[CCSprite spritewithpriteframename:@“po2500001.png”];
[pointbb addChild:spa];
确切的语法适用于其他动画,但此动画除外。如果您作为
CCBatchNode
的子节点添加CCSprite
,我的正确做法应该是什么。。使用batchnode中的纹理
使用这个方法
[CCSprite spriteWithBatchNode: rect:]
如果您将精灵添加到层中,如[self addChild:
。。您的代码将完全
希望这有帮助。:) 如上所述,其他动画使用相同的语法。我不想尝试你的方法。