求助,schedule无法执行的问题

达到效果,让“Hello World” 用schedule向右移动
代码如下:
HelloWorldScene.cpp中


bool HelloWorld::init()
{

auto label = Label::createWithTTF(“Hello World”, “fonts/Marker Felt.ttf”, 24);
label->setPosition(Vec2(origin.x + visibleSize.width/2,
origin.y + visibleSize.height - label->getContentSize().height));
//label->setTag(110);
this->addChild(label, 1);

    this->schedule(schedule_selector(HelloWorld::gameLogic),0.5);


}

void HelloWorld::gameLogic(float t)
{
//auto thisLabel = this->getChildByTag(110);
thisLabel->runAction(MoveBy::create(0.5,Point(240,0)));
};
}

问题是:使用Tag(注释掉的部分),改程序可以执行,那如果不能使用Tag该程序如何运行?
谢谢。

把label 放到.h 文件里面

不行啊,
auto thisLabel = this->getChildByTag(110);
是不是把init方法里的label传递到gameLogic里面的thisLabel?

不用这个 auto thisLabel = this->getChildByTag(110); ,直接使用label ->runAction(MoveBy::create(0.5,Point(240,0)));

编译通不过:6:

他说.h里面放对象的指针, cpp里面赋值和调用

我放了的,但是没有用唉

试试这样:
头文件定义成员变量时用
cocos2d::Label*
或者前边加个USING_NS_CC

问题解决了!!!
感谢:@sylalak123@372187441@aillieo