how to use 2 (or more) CCSpriteBatchNode's instances

99 Views Asked by At

I decided to have some practice with BatchNodes, but I'm stuck here is some code:

[[CCSpriteFrameCache sharedSpriteFrameCache]addSpriteFramesWithFile:@"scene1atlas.plist"];
[[CCSpriteFrameCache sharedSpriteFrameCache]addSpriteFramesWithFile:@"CloudsAtlas.plist"];

        sceneSpriteBatchNode = [CCSpriteBatchNode batchNodeWithFile:@"scene1atlas.png"];
        cloudSpriteBatchNode = [CCSpriteBatchNode batchNodeWithFile:@"CloudsAtlas.png"];

[self addChild:sceneSpriteBatchNode z:20];
[self addChild:cloudSpriteBatchNode z:21];

SomeGameObject *gameObject = [[SomeGameObject alloc]
                         initWithSpriteFrameName:@"sv_anim_1.png"];
gameObject.texture=[sceneSpriteBatchNode texture];

[sceneSpriteBatchNode addChild:gameObject
                                     z:1000 tag:kGameObjectTagValue];

*** Assertion failure in -[GameObject setTexture:]

How to set texture properly?

0

There are 0 best solutions below