达到效果,让“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该程序如何运行?
谢谢。