C++ 运行CC2序列';s在2雪碧上';第二个精灵没有';不要表演动作
我对正在运行操作的CCSequence有问题,我不明白为什么 我很高兴知道如何调试或解决问题。 这是我的代码:C++ 运行CC2序列';s在2雪碧上';第二个精灵没有';不要表演动作,c++,cocos2d-x,C++,Cocos2d X,我对正在运行操作的CCSequence有问题,我不明白为什么 我很高兴知道如何调试或解决问题。 这是我的代码: void Gem::setGemPositionAnimation(Gem* other) { //get the current gem pos that is dragged down CCPoint currentToPoint = this->mySprite->getPosition(); //get the original
void Gem::setGemPositionAnimation(Gem* other)
{
//get the current gem pos that is dragged down
CCPoint currentToPoint = this->mySprite->getPosition();
//get the original upper gem pos , that will be replaced with the gem which is down
CCPoint upperOrigGemPoint = getGemPos();
//CCLOG("Gem %s %s upperOrigGemPoint! x:%f ,y:%f",getImageName().c_str(),getGemId().c_str(),upperOrigGemPoint.x,upperOrigGemPoint.y);
//the down gem pos , that the upper gem suppose to go when dragged down
CCPoint otherOrigGemPoint = other->getGemPos();
//CCLOG("Gem %s %s moveToPoint! x:%f ,y:%f",other->getImageName().c_str(),other->getGemId().c_str(),moveToPoint.x,moveToPoint.y);
//down gem move up action
CCMoveTo *moveUp = CCMoveTo::create(0.3f,upperOrigGemPoint);
CCMoveTo *moveDown = CCMoveTo::create(0.3f,otherOrigGemPoint);
//CCActionInterval *moveUp = CCMoveTo::create(0.3f,upperOrigGemPoint);
//CCActionInterval *moveDown = CCMoveTo::create(0.3f,otherOrigGemPoint);
CCSequence* SequenceActionUpAndDown = CCSequence::create(moveUp,moveDown, NULL);
//CCAction* SequenceActionUpAndDown = CCSpawn::create( moveUp,moveDown, NULL);
other->mySprite->runAction(SequenceActionUpAndDown);
// upper gem move down action
CCSequence* SequenceActionDownAndUp = CCSequence::create( moveDown,moveUp, NULL);
//CCAction *SequenceActionDownAndUp = CCSpawn::create(moveDown,moveUp, NULL);
mySprite->runAction(SequenceActionDownAndUp);
}
现在,在SequenceActionUpAndDown CCAction中,moveDown不做向下移动的动画,它只是跳到它的“向下”(CCMoveTo*moveDown)位置
向上(CCMoveTo*moveUp)动画工作正常。另一个gem SequenceActionDownAndUp动画工作正常。
有什么问题吗
每个gem都在不同的z顺序上运行两个序列运行相同的操作,您需要为每个序列创建单独的操作。感谢您的回答您的博客很好,您能回答这个问题吗: