gpt4 book ai didi

crash - 使用callfuncND在Iphone6模拟器中Cocos2dx崩溃

转载 作者:行者123 更新时间:2023-12-03 17:18:28 24 4
gpt4 key购买 nike

我使用cocos2dx 3.9,但代码在Iphone6的模拟器中崩溃,但在Iphone4s的模拟器中正确运行

void BattleHeroIconCSBLayer::doEffectValue4(CCNode *node)
{
CCCallFuncND *remove = CCCallFuncND::create(node, callfuncND_selector(BattleHeroIconCSBLayer::effectNodeCallBack4), (void*)0);
auto *seq1 = CCSequence::create(MoveBy::create(1.0, ccp(width - node->getContentSize().width, 0)), remove, NULL);
auto *seq2 = CCSequence::create(FadeIn::create(0.3), DelayTime::create(0.4), FadeOut::create(0.3), NULL);
auto *spawn = Spawn::create(seq1, seq2, NULL);
node->runAction(spawn);
}

在BattleHeroIconCSBLayer::effectNodeCallBack4中,我这样做:
void BattleHeroIconCSBLayer::effectNodeCallBack4(CCNode* pTarget, void* data)
{
mBuffBack->setVisible(false);
pTarget->removeFromParentAndCleanup(true);
}

mBuffBack是我的成员变量,我从cocostudio获得它:
mBuffBack = static_cast<Sprite*>(node->getChildByName("mBuffBack"));

但我坠入
mBuffBack->setVisible(false);

使用iphone6的模拟器;

有人可以帮我吗?

最佳答案

根据建议,我用这段代码

auto remove = CallFunc::create( CC_CALLBACK_0(BattleHeroIconCSBLayer::effectNodeCallBack4, this, node, (void*)0));

代替
CCCallFuncND *remove = CCCallFuncND::create(node, callfuncND_selector(BattleHeroIconCSBLayer::effectNodeCallBack4), (void*)0);

它运行正常;但我不知道为什么;

关于crash - 使用callfuncND在Iphone6模拟器中Cocos2dx崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34782976/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com