1

我在 cocos2d 游戏中制作了 1 个动画,但看不到该动画。有人可以帮忙吗?

Animation animation = new Animation("dance", 0.2f);
        for (int i = 1; i < 15; i++) {
            animation.addFrame(new CCFormatter().format("grossini_dance_%02d.png", i));
        }

        IntervalAction action = Animate.action(animation);

        grossini.runAction(action);
4

1 回答 1

2

试试这个:

 public void addPuzzleAnimation() {

            CCAnimation OpenPuzzleAnim = CCAnimation.animation("", 0.1f);

            for (int i = 1; i <= 11; i++) {
                if (i < 10) {
                    OpenPuzzleAnim.addFrame(CCSpriteFrameCache.sharedSpriteFrameCache().spriteFrameByName("trunkOut.0" + i + ".png"));
                } else {
                    OpenPuzzleAnim.addFrame(CCSpriteFrameCache.sharedSpriteFrameCache().spriteFrameByName("trunkOut." + i + ".png"));
                }
                CCAction OpenPuzzleAction = CCAnimate.action(1, OpenPuzzleAnim, false);
                addboxPuzzleOpen.runAction(OpenPuzzleAction);

            }
于 2012-08-17T12:00:47.150 回答