A动画从点a移动到b点,在运动中,动画需要在循环中播放。例如,一个子弹移动到一个点,这个子弹是一个动画,应该在循环中播放。
CCSequence::create(
CCSpawn::createWithTwoActions(
CCTargetedAction::create(sprite, CCMoveTo::create(3.0f, point_a)),
CCTargetedAction::create(sprite, CCRepeatForever::create(CCAnimate::create(animation)))
),0);
但CCRepeatForever不能成为动作序列的成员。那怎么做呢?我使用序列是因为还有其他动作在排队(上面省略了)
发布于 2013-11-29 06:43:52
你不需要用ccspawn来做这个..。也不是ccsequence只在对象上单独运行两个操作。
CCSprite *newSprite=CCSprite::create("imageName");
CCAnimation *animation=CCAnimation::create();
//..some code to add frames to this animation object..
//to repeat for indefinite time you could setLoops to -1 or use CCRepeatForever class //like this..
//1:
animation->setLoops(-1);
newSprite->runAction(CCAnimate:create(animation));
//or..
//2:
newSprite->runAction(CCRepeatForever:create(CCAnimate:create(animation)));
//now to translate this sprite simultaneously use this.
newSprite->runAction(CCMoveTo::create(3.0,point_a));
https://stackoverflow.com/questions/20115184
复制相似问题