Quantcast
Channel: Cocos中文社区 - 最新主题
Viewing all articles
Browse latest Browse all 88737

请问下creator如何在精灵运动的时候不触发touch事件

$
0
0

@758482981 写道:

绳子一开始是摇晃的,点击后生长,然后缩小,然后回归摇晃,我这么写会点击会一直长,如何在放大缩小的时候不能点击呀
onLoad: function () {
this.shakeAction = cc.repeatForever(cc.sequence(cc.rotateTo(3,60),cc.rotateTo(3,-60)));
this.node.runAction(this.shakeAction)
this.move = false
if(!this.move){
this.touch()}
},
touch:function(){
var self = this;
var listener1 = cc.EventListener.create({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
onTouchBegan: function (touch, event) {

        this.scale()
        return true;
        }.bind(self),
        onTouchEnded: function (touch, event) { 
        }.bind(self)
    });
    cc.eventManager.addListener(listener1, this.node);
},
scale:function(){
       this.move = true
       this.node.stopAllActions();
        var f1 = cc.scaleBy(2, 1, 2);
        var f2 = f1.reverse();
        var f3 = cc.sequence(f1,f2,cc.callFunc(function() {
            this.node.runAction(this.shakeAction);
            this.move = false
         }, this));
        this.node.runAction(f3)
},

帖子: 2

参与者: 1

阅读整个主题


Viewing all articles
Browse latest Browse all 88737

Trending Articles



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