Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Cocos2d-android - I have an animation which has 5 Frames they are close cropped images. Now I want Sprite to do animation as well as Move in X direction.i.e. I have a player running which gets collided with obstacle and falls down .. Now I want sprite to run animation as well as moveBy in -ve x direction

gameOverAnimation =CCSprite.sprite("gmovr00")
gameOverAnimation.setAnchorPoint(0, 0);
gameOverAnimation.setPosition(340.0f, 200.0f);
CCIntervalAction action1 = CCAnimate.action(mEndAnimation, false);
CCIntervalAction delay = CCDelayTime.action(0.68f);
CCMoveBy actionBy = CCMoveBy.action(1.0f, CGPoint.ccp(-340,0)); 
CCIntervalAction seq1 = CCSpawn.actions(action1,actionBy);
//CCSpawn spawn = CCSpawn.actions(action1, actionBy);
                CCSequence sequence1 = CCSequence.actions(seq1,CCCallFuncN.action(this,"gameOver"));

Above code makes animation run first then moved in y direction

Thanks for the help.. And can some one explaing me the concept of time with frame Animation or good example ?

share|improve this question
            grossini = CCSprite.sprite(CCSpriteFrameCache.sharedSpriteFrameCache().spriteFrameByName("grossini_dance_01.png"));
            grossini.setPosition(CGPoint.make(60, fullheight / 3));
            CCAnimation anim = CCAnimation.animation("", 0.3f);
            for (int i = 2; i <10; i++) {
                anim.addFrame(CCSpriteFrameCache.sharedSpriteFrameCache().spriteFrameByName("grossini_dance_0" + i + ".png"));
            // Creating animation action
            CCAction animaction = CCAnimate.action(2, anim, true);

Hope it help!!!!!!!!!!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.