IT/- 프로그래밍
Cocos 회전하는 액션기능 (RotateBy)
혁준7519
2017. 2. 10. 09:58
회전하는 액션기능 (RotateBy)
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 | #include "test118.hpp" USING_NS_CC; Scene* Test118::createScene() { auto scene = Scene::create(); auto layer = Test118::create(); scene->addChild(layer); return scene; } bool Test118::init() { if ( !Layer::init()) { return false; } auto sprite = Sprite::create("testimage.png"); sprite->setPosition(Point(100,100)); this->addChild(sprite); //RotateBy(액션시간, 회전각도) //RotateTo : 입력한 각도로 가장 빠르게 회전, RotateBy : +는 시계방향 -는 반시계방향으로 지정한 값만큼 회전 auto action = RotateBy::create(2.0, 450); //시계방향으로 450도 회전 sprite->runAction(action); return true; } | cs |
결과