0

我对正在运行的 CCSequence 有问题,我不明白为什么我会很高兴知道如何调试或解决问题。这是我的代码:

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)动画工作正常。
和其他宝石 SequenceActionDownAndUp 动画工作正常。
可能是什么问题?

每个宝石都是不同 z 顺序的 CCSprit

4

1 回答 1

1

两个序列运行相同的动作,您需要为每个序列创建单独的动作。

于 2013-07-25T09:07:13.783 回答