尝试在延迟后运行GoToGameOverScene(this)函数。我得到“无视值,因为它应该是”
// set up the time delay
DelayTime *delayAction = DelayTime::create(2.5f);
// perform the selector call
CallFunc *callSelectorAction = CallFunc::create(this, SEL_CallFunc(GoToGameOverScene(this)));
// run the action
this->runAction(Sequence::create(delayAction, callSelectorAction, NULL));
其他功能如下:
void GameScreen::GoToGameOverScene(cocos2d::Ref *pSender)
{
auto scene = GameOver::createScene();
Director::getInstance()->replaceScene(scene);
}
答案 0 :(得分:1)
SpriteNM->runAction(Sequence::create(DelayTime::create(1.0),CallFunc::create(std::bind(&ClassNM::MethodNM, this,IfParameter)),NULL));
答案 1 :(得分:0)
更改此
CallFunc *callSelectorAction = CallFunc::create(this, SEL_CallFunc(GoToGameOverScene(this)));
到
CallFunc *callSelectorAction = CallFunc::create(this, callfunc_selector(ClassName::GoToGameOverScene));
干杯...
答案 2 :(得分:0)
如果您使用的是v 3.3,则必须以这种方式使用它:
CallFunc *callSelectorAction = CallFunc::create(this, CC_CALLBACK_1(ClassName:GoToGameOverScene,this));
其中,CC_CALLBACK_1在您的函数有一个参数时使用。
答案 3 :(得分:0)
this->runAction(Sequence::create(DelayTime::create(1.0),CallFunc::create(std::bind(&ClassName::MethodName, this,IfParameter)),NULL));
或强>
SpriteName->runAction(Sequence::create(DelayTime::create(1.0),CallFunc::create(std::bind(&ClassName::MethodName, this,IfParameter)),NULL));