1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #include "HelloWorldScene.h" Scene* HelloWorld::createScene() { auto scene = Scene::create(); auto layer = HelloWorld::create(); scene->addChild(layer); return scene; } bool HelloWorld::init() { if (!Layer::init()) { return false; } auto spr = Sprite::create("ball.png"); spr->setPosition(Point(100, 100)); this->addChild(spr); auto action_0 = MoveBy::create(2.0, Point(400, 100)); auto action_1 = action_0->reverse(); auto action_2 = Sequence::create(action_0, action_1, NULL); spr->runAction(action_2); return true; } | cs |
리버스 액션을 구현 할 때에는 MoveBy를 사용해야 정상적으로 작동합니다.