Moving a Sprite?

I’m new to cocos2dx and i just started to learn.I have no experience with any game engine or framework.I’m trying to move my sprite and I’m doing this by running an action.But sprite doesn’t move.I’m in android and I’m working with Android Studio.Here is my onTouchBegan code:

bool HelloWorld::onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *event) {
    if(touch->getLocation().x > HelloWorld::mysprite->getPosition().x){
        HelloWorld::mysprite->runAction(HelloWorld::bagil);
        return true;
    }
    else if(touch->getLocation().x < HelloWorld::mysprite->getPosition().x){
        HelloWorld::mysprite->runAction(HelloWorld::bagil2);
        return true;
    }
    else{
        return false;
    }
}

We have docs here: http://www.cocos2d-x.org/docs/cocos2d-x/en/
Plus every engine feature is demonstrated in build/cpp-tests

Here are the docs for Event Dispatcher: http://www.cocos2d-x.org/docs/cocos2d-x/en/event_dispatcher/

use something like this:

listener->onTouchBegan = [&](cocos2d::Touch* touch, cocos2d::Event* event)
    {
            cocos2d::Vec2 p = touch->getLocation();
            cocos2d::Rect rect = this->getBoundingBox();
            
            if(rect.containsPoint(p))
            {
                CornSprite::touchEvent(touch);
                return true;
            }
        
        return false;
    };

If I didn’t understand wrong there isn’t something wrong about my onTouchBegan code right ?Should fix up my listener code ?

You can move a Sprite by touching it, running an Action on it or even building a Sequence. I would try my code with yours and see how you work out. Post more if you need to. We are here to help. Also, check your scope of classes to ensure the scope is valid when used.