0

我决定对 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:]

如何正确设置纹理?

4

0 回答 0