pmsprite = Sprite::createWithSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(buff));
Point newPos = pEnemySprite->getcurPoint();
Animate *pAnimate = Animate::create(pAnimation);
pmsprite->setPosition(newPos);
this->addChild(pmsprite);
CallFuncN* mactiondone = CallFuncN::create(CC_CALLBACK_0(EnemyLayer::f_removemyAnimation, this, pmsprite));
auto seq = Sequence::create(pAnimate, mactiondone, NULL);
pmsprite->runAction(seq);
removeEnemy(pEnemySprite);
updateScore(m_score);
}
void EnemyLayer::f_removemyAnimation(Node *pNode) {
Sprite *sp = (Sprite *) pNode;
this->removeChild(sp);
}
CC_CALLBACK_0不是传递0个参数吗?为什么回调有个参数
还有传过去的pNode是pmsprite还是pAnimate,如果是pmsprite的话里面已经释放了 后面还执行动作,应该会出错吧?
看回调函数的名字是:f_removemyAnimation 代表移除动画 难道是 pAnimate 是代码写错了?
请教下