cocos2d-x action执行完毕的回调

时间:2021-03-16 12:55:43

cocos2d-x action执行完毕的回调

MySprite::createOne()

{

....

//  MUST add to sheet firstly
        spriteSheet->addChild(sprite);

        // create action
        auto createAction = MoveTo::create(3.0f, Point(pos.x, pos.y));

        auto sequence = Sequence::create(createAction,
            CallFuncN::create(CC_CALLBACK_1(MySprite::onAfterCreateAction, sprite)), 0);

        sprite->runAction(sequence);

}

MySprite::onAfterCreateAction(Node * pSender)

{

MySprite * pThis = (MySprite *) pSender;

....

}

相关文章