[Win8] CCMoveTo

    CCPoint pos1 = tmpPieces[i1][j1]->getPosition();
    CCPoint pos2 = tmpPieces[i2][j2]->getPosition();
    CCSprite* tmpSpr = tmpPieces[i1][j1];
    tmpPieces[i1][j1] = tmpPieces[i2][j2];
    tmpPieces[i2][j2] = tmpSpr;

    CCActionInterval* move = CCMoveTo::actionWithDuration(0.2,pos1);
    tmpPieces[i1][j1]->runAction(move);

    CCActionInterval* move2 = CCMoveTo::actionWithDuration(0.2,pos2);
    tmpPieces[i2][j2]->runAction(move2);

Directly setting positions worked ok, but I wanted to animate the swapping using CCAction, but in the above codes the runAction does not seem to work. I referred to the ActionsTest project and it does not seem like I coded anything wrong. IS there anything else I needed to do to get the CCMoveTo working?

nvm, answer found on stackoverflow. OnEnter was overridden and needs to call CCLayer::OnEnter in the overridden OnEnter

Edmund Ching wrote:

nvm, answer found on stackoverflow. OnEnter was overridden and needs to call CCLayer::OnEnter in the overridden OnEnter
Hello.I call CCLayer::OnEnter in the overridden OnEnter.but it failed

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts

(Press Retry to debug the application - JIT must be enabled)HelloWorld.exe 已触发了一个断点。