Stuck..help please. How to remove sprites by touch while it's running actions?

Actually, I’m developing rhythm game now.
I made each tap notes to disappear when it touched, like this::

bool myGame::init(){ ... noteCall(); ... }
void myGame::noteCall(){
    tapNote(time1, position1, type1...);
    tapNote(time2, position2, type2...);
    tapNote(time3, position3, type3...);
    ...
}
void myGame::tapNote(...){
   //created tapNote sprite as "spr"
   auto action = Seq(...);
   spr->runAction(action);
}

and I made listener for each tapNote()
(is that right?? I’m new developing games with cocos2d-x…)

void myGame::tapNote(...){
...
    EventDispatcher *dispatcher = Director::getInstance() -> getEventDispatcher();
    auto listener = EventListenerTouchOneByOne::create();
    listener -> setSwallowTouches(true);
    listener -> onTouchBegan = CC_CALLBACK_2(myGame::onTouchBegan, this);
    dispatcher -> addEventListenerWithSceneGraphPriority(listener, spr);
...
}

onTouchBegan is here.

    bool myGame::onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *event){
    CallFuncN *remove = CallFuncN::create(CC_CALLBACK_1(myGame::deleteNode, this));
    //I used "removeFromParentAndCleanup(true)" method in myGame::deleteNode
    auto target = event -> getCurrentTarget();
    
    Point location = touch -> getLocation();
    location = Director::getInstance()->convertToGL(location);
    Rect boundingBox = target -> boundingBox();

    if (boundingBox.containsPoint(location)){
        auto action = Seq(..., remove, NULL);
        target->stopAllActions();
        target->runAction(action);
    }
...
}

I thought there was no problem…
but when it runs, if I touch tapNotes, nothing happen.
I’ve started debugging 2 days ago, but I failed to solve this problem…
In CCLOG, boundingBox does not contains location, nothing happens.
Also I tried else if (!contain…) {//same thing}, every tapNotes disappeared…
I think there is a problem when listener swallow touches, if the target sprite is running actions.
How can I solve this problem? Help!

Does the if statement get executed? What’s the value of location and boundingBox? You must keep them both in world coordinate or node coordinate.

Thanks! I didn’t know that xD

:smile: Has the issue been solved?