Hello,
I am quite new in cocos2d-x and i’ve met some problems recently. I am trying to run a simple animation for as long as my character is moving. Take a look at this code snippet:
@
CCTexture2D texture = CCTextureCache::sharedTextureCache~~>addImage;
CCSpriteBatchNode spritesheet = CCSpriteBatchNode::createWithTexture;
this~~>addChild;
CCSpriteFrame frame0 = CCSpriteFrame::createWithTexture, CCRectMake);
CCSpriteFrameframe1 = CCSpriteFrame::createWithTexture, CCRectMake);
CCSpriteFrame frame2 = CCSpriteFrame::createWithTexture, CCRectMake);
CCArray animFrames = CCArray::createWithCapacity;
animFrames~~>addObject;
animFrames~~>addObject;
CCAnimation animation = CCAnimation::createWithSpriteFrames;
CCAnimationCache::sharedAnimationCache~~>addAnimation;
CCSprite* sprite = CCSprite::createWithSpriteFrame;
sprite~~>setPosition );
spritesheet~~>addChild;
CCAnimationCache animCache = CCAnimationCache::sharedAnimationCache;
CCAnimationnormal = animCache~~>animationByName;
normal~~>setRestoreOriginalFrame;
normal~~>setDelayPerUnit;
CCPointArrayarray = CCPointArray::create;
array~~>addControlPoint);
array~~>addControlPoint);
array~~>addControlPoint);
array~~>addControlPoint);
array~~>addControlPoint);
CCCardinalSplineByaction = CCCardinalSplineBy::create;
CCAnimate animN = CCAnimate::create;
CCActionIntervalreverse = action~~>reverse;
CCFiniteTimeActionseq = CCSequence::create(action, reverse, NULL);
sprite->runAction(CCSpawn::createWithTwoActions(animN,seq));
@
In this case CCCardinalSplineBy *action will be played for 8 seconds, how to atomatically loop animN to be played for the same time?