IT/- 프로그래밍
Cocos 순서대로 액션 실행하기 (Sequence)
혁준7519
2017. 2. 20. 09:19
순서대로 액션 실행하기 (Sequence)
c++)
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 31 32 33 34 35 36 37 38 | #include "test129.hpp" USING_NS_CC; Scene* Test129::createScene() { auto scene = Scene::create(); auto layer = Test129::create(); scene->addChild(layer); return scene; } bool Test129::init() { if ( !Layer::init()) { return false; } auto sprite = Sprite::create("ball.png"); sprite->setPosition(Point(100,100)); this->addChild(sprite); auto action1 = MoveTo::create(2.0, Point(400,100)); auto action2 = MoveTo::create(2.0, Point(400,250)); //Sequence::create(액션1, 액션2,..., NULL) : 순서대로 액션을 실행한다 auto action3 = Sequence::create(action1, action2, NULL); sprite->runAction(action3); return true; } | cs |
결과
액션1과 액션2가 순서대로 실행되어 위치가 이동된다