bool HelloWorld::onTouchBegan(Touch *touch, Event *unused_event) {

    posStartTouch=touch->getLocation();

    

    auto sprPlayer=(Sprite*)this->getChildByTag(TAG_SPRITE_PLAYER);

    posStartPlayer = sprPlayer->getPosition();

    

    return true;

}



void HelloWorld::onTouchMoved(Touch *touch, Event *unused_event) {

    Point location=touch->getLocation();

    

    Point posChange=location-posStartTouch;

    

    auto sprPlayer=(Sprite*)this->getChildByTag(TAG_SPRITE_PLAYER);

    Point total =posStartPlayer+posChange;

    

    

    sprPlayer->setPosition(total);

}






레알 개초보다 .. cocos2d-x에서 터치 영역 관련 부분인데 ..

조건문 넣어서 캐릭터가 오른쪽으로 이동 시 a문자 출력

왼쪽으로 이동시 b문자 출력


이렇게 구현하고 싶은데 .. 와 진짜 도저히 모르겠다 .. 

if문 넣어서 (location.x > total.x) 이 지랄 다 해봤는데 ...


제대로 구현이 안돼 ㅜㅜㅜ 도와줘 고수님들 ㅜㅜ