Reputation: 887
I created two the same CCSpriteBatchNode, add in different CCLayer respectively.
CCSpriteBatchNode *mNode = [param objectForKey:@"BatchNode"];
if (self =[super initWithTexture:mNode.texture rect:rect ])
{
CCAnimation *walkAnim = [CCAnimation animationWithFrames:[[allFrameCache objectAtIndex:0] objectAtIndex:0] delay:frequencyFloat];
CCAction* walkAction = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:walkAnim restoreOriginalFrame:NO]];
[self runAction:walkAction];
}
But it show: 2012-07-15 11:18:27.389 SanGuo_[21379:707] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'CCSprite is not using the same texture id'
I am a novice, research for a long time, I was very depressed, who can help me?
Upvotes: 1
Views: 3698
Reputation: 64477
CCSprite is not using the same texture id
You can only add sprites to a sprite batch node which are using the same texture as the sprite batch node. This is the error you get when you try to add a sprite to a batch node with a different texture than the batch node.
Solution: make sure that sprite uses the same texture as the batch node.
Upvotes: 3