我想使用 android在cocos2d中动画一个移动的精灵,请帮助 这是我的代码: public void setMoveAnimation(CCSprite target) { //CCSprite target = CCSprite.sprite("Target.png"); CCAnimation OpenAnim = CCAnimation.animation("",
这是我的代码:
public void setMoveAnimation(CCSprite target) { //CCSprite target = CCSprite.sprite("Target.png"); CCAnimation OpenAnim = CCAnimation.animation("", 0.1f); for (int i = 1; i <= 2; i++) { OpenAnim.addFrame(CCSpriteFrameCache.sharedSpriteFrameCache().spriteFrameByName("target.0" + i + ".png")); CCAction MoveAction = CCAnimate.action(1, OpenAnim, false); target.runAction(MoveAction); } }你可以这样做这对我有用. devil1.png,devil2.png像这样upto devil4.png
CCAnimation animation = CCAnimation.animation("dance", 0.2f); for (int i = 1; i < 5; i++) { animation.addFrame(CCFormatter.format(devil%d.png, i)); } CCIntervalAction action = CCAnimate.action(animation); target.runAction(CCRepeat.action(action, 9));