1

I know there is "the simple game sample of Android Cocos2D" and "how-to-animate-sprites-in-cocos2d". I use the "space shooter" Android source code as sample, create a simple card game.

But there is the big problem that I don't know how to use CCSpriteFrame to create the sprite animation for the cards. The space shooter does not have any animation code.

So I am here to asking the code sample about how to create sprite animation by using Cocos2D Android (JAVA VERSION).

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
Fenix Lam
  • 386
  • 6
  • 22
  • No need for shouting. If you tagged your question with cocos2d-android to begin with (you used cocos2d-iphone) you wouldn't have to worry about getting an answer related to cocos2d-iphone. – CodeSmile Jan 23 '12 at 21:51

1 Answers1

1

This is the way which i use for my animation hope it will helpfull for you.

ArrayList<CCSpriteFrame> animFrames = new ArrayList<CCSpriteFrame>();
              CCSpriteFrameCache.sharedSpriteFrameCache();
              for (int i = 1;i <= 4; i++)
              { CCSpriteFrame frame = CCSpriteFrameCache.sharedSpriteFrameCache().spriteFrameByName( "sparkle." + i +".png");
              animFrames.add(frame);
              }