0
n init方法正在啓動一個CCAnimation。沒關係。在觸摸結束的方法是停止動畫。在停止的時候,我需要獲取當前動畫的圖像。在CCAnimation中獲取圖像Cocos2d-x
Player = CCSprite::create("AngleSelector1.png");
Player->setPosition(ccp(size.width/2, size.height/2));
this->addChild(Player);
//Animation
CCAnimation *animate = CCAnimation::create();
for (int i = 1; i <=10; i++)
{
char frameName[128] = {0};
sprintf(frameName, "AngleSelector%d.png", i);
animate->addSpriteFrameWithFileName(frameName) ;
}
animate->setDelayPerUnit(0.35f); // This animation contains 3 frames, will continuous 2.8 seconds.
animate->setRestoreOriginalFrame(true); // Return to the 1st frame after the 3rd frame is played.
CCAnimate *animaction = CCAnimate::create(animate);
CCRepeatForever *rt = CCRepeatForever::create(animaction);
Player->runAction(rt);
this->setTouchEnabled(true);
void HelloWorld::ccTouchesEnded(CCSet* touches, CCEvent* event)
{
Player->stopAllActions();
}
,這將是在精靈的spriteFrame或displayFrame財產,根據版本 – LearnCocos2D 2014-09-27 09:52:17
Cocos2dx 2.2.2正在使用。那裏有什麼特色嗎? – Sri 2014-09-27 20:29:47
檢查課程參考 – LearnCocos2D 2014-09-28 11:14:58