Pergunta

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.

gameOverAnimation =CCSprite.sprite("gmovr")
gameOverAnimation.setAnchorPoint(0, 0);
gameOverAnimation.setPosition(340.0f, 200.0f);
addChild(gameOverAnimation,10);
CCIntervalAction action1 = CCAnimate.action(mEndAnimation, false); 
action1.setDuration(1.0f);
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"));
                gameOverAnimation.runAction(sequence1);

And please can some explain me proper difference between Frame based and Time based animation. I want to do time based animation

Foi útil?

Solução

What do you mean under Frame based animation? Almost all the actions in cocos2d engine divided into 2 groups. Instant and interval actions. Instant actions are continuous actions. CCAnimate action that use frames is subclass of CCActionInterval, so it is "time based" action

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top