2012-08-08 113 views
1

我在cocos2d遊戲中製作了1個動畫,但無法看到該動畫。任何人都可以幫忙嗎?Android cocos2d動畫

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); 

回答

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); 

      }