2013-07-25 30 views
0

我有CCSequence正在運行的行動的問題,我不明白爲什麼 我會很高興知道如何調試或解決問題。 這是我的代碼:運行2個CCSequence的2 Sprite的第二個精靈不會執行動作

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的下移沒有做向下移動,它只是跳轉到其「向下」(CCMoveTo *下移)位置 向上(CCMoveTo *爲moveUp的動畫)動畫工作正常。
和其他gem SequenceActionDownAndUp動畫工作正常。
有什麼可以解決的問題?

每個寶石CCSprit不同的Z順序

回答

1

兩個序列運行相同的動作,你需要爲每個序列單獨行動。

+0

感謝您的博客是偉大的答案,你可以請採取以下問題: http://stackoverflow.com/questions/17879355/moving-ccsprit-to-the-left-causing-strange-movement-所有其他的方向,是工作 – user63898

相關問題