【问题标题】:add animation in cocos2d在 cocos2d 中添加动画
【发布时间】:2011-03-07 07:28:33
【问题描述】:

如何在 cocos2d 中的 sprite 中添加动画,问题是每当使用触发对象并击中该对象时,该对象将像动画一样被移除.. 如果您有任何教程,请发送给我...

thnx

【问题讨论】:

    标签: iphone cocos2d-iphone


    【解决方案1】:

    您可以使用图像精灵表,然后使用图像制作动画。

    对于代码示例,您可以尝试以下教程。

    http://www.raywenderlich.com/1271/how-to-use-animations-and-sprite-sheets-in-cocos2d

    【讨论】:

      【解决方案2】:

      cocos2d 有很多例子。包括使用一组图像的动画。看看 SpriteTest 示例 - 这就是您要查找的内容

      【讨论】:

        【解决方案3】:

        就用这个

            CCSpriteSheet *mgr = [CCSpriteSheet spriteSheetWithFile:@"yourImage.png" capacity:5];
            [self addChild:mgr z:0 tag:4];    //set the image and load it to the CCLayer
        
            sprite = [CCSprite spriteWithTexture:mgr.texture rect:CGRectMake(0, 0, 30, 30)];
            [sprite runAction:[CCFadeTo actionWithDuration: 1 opacity:80]];
        

        【讨论】:

        • 但是图片呢?我想使用带有图像的动画
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-08-13
        • 1970-01-01
        相关资源
        最近更新 更多