Quantcast
Channel: Cocos中文社区 - 最新帖子
Viewing all articles
Browse latest Browse all 495283

停止动作执行后,还会执行回调函数

$
0
0

这个是正常行为,机制问题,因为 cc.callFunc(function () { cc.log('1'); } 是立即执行的,而 node.stopAllActions(); 会在下一帧才暂停如果你修改为以下代码就不会出现那样的问题了:

var action = cc.sequence(
        cc.delayTime(0), 
        cc.callFunc(function () {
            cc.log('1');
        }), cc.moveBy(1, 50, 50), cc.callFunc(function () {
            if (b) {
                node.stopAllActions();
                cc.log('stopAllActions');
            }
        })).repeatForever();

Viewing all articles
Browse latest Browse all 495283

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>