액션기능으로 이미지 이동하기
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 "test108.hpp" USING_NS_CC; Scene* Test108::createScene() { auto scene = Scene::create(); auto layer = Test108::create(); scene->addChild(layer); return scene; } bool Test108::init() { if ( !Layer::init()) { return false; } auto sprite = Sprite::create("ball.png"); sprite->setPosition(Point(50,50)); this->addChild(sprite); //-By : 상대적인 값으로 변경, -To : 절대값으로 변경 //MoveTo::create(이동시간, 이동할위치) auto action = MoveTo::create(3, Point(450, 50)); //runAction(액션) : 객체에 액션지정 sprite->runAction(action); return true; } | cs |
결과
'IT > - 프로그래밍' 카테고리의 다른 글
OpenCV OpenCV 설치 (0) | 2017.02.04 |
---|---|
안드로이드 다운받은 apk 파일 추출하기 (adb 명령어 사용) (0) | 2017.02.03 |
안드로이드 TabLayout 밑의 그림자 없애기 (0) | 2017.02.02 |
Cocos 토글 아이템메뉴 사용하기 (0) | 2017.02.02 |
Cocos Sprite를 이용한 메뉴 생성하기 (0) | 2017.02.01 |