0
我的遊戲中的單位可以在8個方向上移動(N,NE,E,SE等)。當單位改變方向時,我希望CCAnimate保留動畫幀(僅改變CCAnimation),以避免單位在中間變換時動畫跳躍。我當前的代碼:更改CCAnimation,但保留幀索引
pSprite->stopAllActions();
CCAnimate* animate = CCAnimate::create((*currentAnimation)[(int)facing]);
CCRepeatForever* action = CCRepeatForever::create(animate);
pSprite->runAction(action);
其中currentAnimation是包含CCSpriteFrame數組的向量。我如何實現它? 我正在使用cocos2d-x 2.2