如何使用2个(或更多)CCSpriteBatchNode的实例

时间:2013-01-31 10:15:42

标签: cocos2d-iphone ccspritebatchnode

我决定使用BatchNodes进行一些练习,但是我被卡住了 这是一些代码:

[[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:]

如何正确设置纹理?

0 个答案:

没有答案