【问题标题】:Cocos2D Sprite Animation Batch Node TroublesCocos2D Sprite 动画批处理节点问题
【发布时间】:2012-05-15 14:48:31
【问题描述】:

我收到以下错误:'CCSprite is not using the same texture 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];

确切的语法适用于除此之外的其他动画。我的正确做法应该是什么?

【问题讨论】:

    标签: animation cocos2d-iphone


    【解决方案1】:

    如果您将CCSprite 添加为CCBatchNode.. 的子级,请使用batchnode 中的纹理..

    使用这个方法..

    [CCSprite spriteWithBatchNode: rect:]
    

    如果您将精灵添加到像[self addChild:] 这样的层..您的代码将完美..

    希望这会有所帮助。 :)

    【讨论】:

    • 如前所述,其他动画使用相同的语法。我不想尝试你的方法。
    猜你喜欢
    • 2014-05-12
    • 2014-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-03
    • 2017-05-16
    • 1970-01-01
    相关资源
    最近更新 更多