双击判断

方法一:移动也会判断成双击 

onTouchesEnded:function(touches, event) {

        var touchOne =touches[0];
        var str = touchOne.getPreviousLocation().x + "
" + touchOne.getLocation().x;
        this._logLabel.setString(str);
        if (Math.abs(touchOne.getDelta().x) <=6 && Math.abs(touchOne.getDelta().y) <=6  ) {
            var bigger = cc.ScaleBy.create(3, 2);  //变大
            var smaller = bigger.reverse(); // 恢复
            this._ship.runAction(cc.Sequence.create(bigger,smaller));
        }


    },

方法二:仅仅判定双击

onTouchesEnded:function(touches, event) {
        var touchOne =touches[0];

        var str = "原坐标:" + "
"
            + this._lastTouchPos.x + "
"
            + this._lastTouchPos.y + "
"
            + "新坐标:" + "
"
            + touchOne.getLocation().x + "
"
            + touchOne.getLocation().y + "
"
        this._posLabel.setString(str);

        // 有效双击判定,只有距离,没加上双击时间判定
        if (Math.abs(cc.pDistance(touchOne.getLocation(),this._lastTouchPos)) < 20) {
            this.onCaptainSkill(null);
        }
        else {
            this._lastTouchPos = touchOne.getLocation();
        }
    },
    onTouchesMoved:function (touches, event) {
        this._posLabel.setString("移动");
        this._lastTouchPos = cc.p(0,0);
        this.processEvent(touches[0]);
    },
原文地址:https://www.cnblogs.com/linn/p/3501914.html