Action has no listener?

i make bullet and the unit fire the bullet.
and i use action(node.runAction()) cc.moveTo for bullet’s node.

start(){
       this.action = cc.moveTo(distance / movePixel, targetX, targetY);
       this.node.runAction(action);
}

and i check finish the action in update() method.
(i think, if it has listener, use listener is better than check every frames
but i can’t found action listener. so i use this way i don’t have any choice)

 update(dt) {
        if (this.action && this.action .isDone()) {
            cc.log("bullet" + this.bulletId + " is arrived to target!");
            this.damageToTarget();
        }
}

action is no have listener?
every frame check is no good idea

(ps> i don’t want use collision checker. )

cocos creator version : 1.10.2

Use cc.callFunc() in sequence with your action

start(){
    this.action = cc.moveTo(distance / movePixel, targetX, targetY);
    this.node.runAction( cc.sequence(action, cc.callFunc(this.CallbackFunction, this)));
}

thanks a lot and best regards !

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.