RotateBy : 현재상태에서 시계방향으로 각도만큼 회전

RotateTo : 절대적 각도만큼 회전



bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    }

    Size visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();

    mySprite = Sprite::create("CloseNormal.png");
    mySprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
    this->addChild(mySprite);
    
    //추가할 내용
	auto action = RotateBy::create(3, 90);
	mySprite->runAction(action);

    return true;
}

'Cocos2D-X' 카테고리의 다른 글

간단하게 데이터 저장 - UserDefault 사용법  (0) 2016.06.15
색상(TintBy, TintTo)  (0) 2016.05.15
스케일(ScaleBy, ScaleTo)  (0) 2016.05.09
어떤 지점에 놓음(Place)  (0) 2016.05.09
3차 베지어곡선(BezierBy, BezierTo)  (0) 2016.05.08
Posted by 빵원군
,

ScaleBy와 ScaleTo의 차이는 문서상에는 ScaleTo가 reverse를 지원하지 않는다고 한다.

아직은 reverse가 뭔지는 모르겠다. 다시 원상태로 돌리는건가? 거꾸로 하는건가?


bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    }

    Size visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();

    mySprite = Sprite::create("CloseNormal.png");
    mySprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
    this->addChild(mySprite);
    
    //추가할 내용
	auto action = ScaleBy::create(3,3,0.25);
	mySprite->runAction(action);

    return true;
}


'Cocos2D-X' 카테고리의 다른 글

색상(TintBy, TintTo)  (0) 2016.05.15
회전(RotateBy, RotateTo)  (0) 2016.05.09
어떤 지점에 놓음(Place)  (0) 2016.05.09
3차 베지어곡선(BezierBy, BezierTo)  (0) 2016.05.08
점프 시뮬레이션(JumpBy, JumpTo)  (0) 2016.05.08
Posted by 빵원군
,

어떤 지점에 놓는 것


bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    }

    Size visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();

    mySprite = Sprite::create("CloseNormal.png");
    mySprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
    this->addChild(mySprite);
    
    //추가할 내용
	auto action = Place::create(Vec2(100, 200));
	mySprite->runAction(action);

    return true;
}

'Cocos2D-X' 카테고리의 다른 글

회전(RotateBy, RotateTo)  (0) 2016.05.09
스케일(ScaleBy, ScaleTo)  (0) 2016.05.09
3차 베지어곡선(BezierBy, BezierTo)  (0) 2016.05.08
점프 시뮬레이션(JumpBy, JumpTo)  (0) 2016.05.08
스프라이트 이동(MoveBy, MoveTo)  (0) 2016.05.07
Posted by 빵원군
,