Created
September 17, 2013 03:45
-
-
Save liu7yong/6589855 to your computer and use it in GitHub Desktop.
animate each image as a frame (like gif) in cocos2d-x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CCSprite *pSkill = (CCSprite *) getChildByTag(TAG_MENU)->getChildByTag(tag); | |
CCSprite *pHighLight = CCSprite::createWithSpriteFrameName("point1.png"); | |
this->addChild(pHighLight, Z_ORDER_TITLE, TAG_SKILL_HIGHLIGHT); | |
pHighLight->setPosition(pSkill->getPosition()); | |
CCArray *walkAnimFrames = CCArray::create(); | |
for (int i = 1; i<= 4; i++) | |
{ | |
walkAnimFrames->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(CCString::createWithFormat("point%d.png", i)->getCString())); | |
} | |
CCAnimation *walkAnim = CCAnimation::createWithSpriteFrames(walkAnimFrames, 0.3f); | |
pHighLight->runAction(CCRepeatForever::create(CCAnimate::create(walkAnim))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment