/*ActionManagerTest.h==================================================================*/
class LogicTest : public ActionManagerTest
{
public:
virtual std::string subtitle() const override;
virtual void onEnter() override;
void bugMe(Node* node);
};
/*ActionManagerTest.cpp==================================================================*/
void LogicTest::onEnter()
{ActionManagerTest::onEnter();
auto grossini = Sprite::create(s_pathGrossini); //创建精灵grossini
addChild(grossini, 0, 2);
grossini->setPosition(VisibleRect::center()); //grossini 放在中心位置
//run动作列队 1.MoveBy:相对位置 x位置+150,即右移150 2.调bugMe
grossini->runAction( Sequence::create(MoveBy::create(1, Vec2(150,0)), //
CallFuncN::create(CC_CALLBACK_1(LogicTest::bugMe,this)),
nullptr)
);
}
//bugMe :1停止运动 2 ScaleTo:整体比例放大2,(宽x2 高x2)
void LogicTest::bugMe(Node* node)
{
node->stopAllActions(); //After this stop next action not working, if remove this stop everything is workingnode->runAction(ScaleTo::create(2, 2));
}
//标题 “Logic test”
std::string LogicTest::subtitle() const
{
return "Logic test";
}