coco2d-js 触摸移动的同时处理点击事件

时间:2014-08-18 18:30:42   收藏:0   阅读:333
        cc.eventManager.addListener({
            event: cc.EventListener.TOUCH_ALL_AT_ONCE,
            onTouchesMoved:function (touches, event) {
                for (var i = 0; i < touches.length; i++) {
                    jslog("touches:", i, touches[i].getLocation().x, touches[i].getLocation().y);
                }
            },
            onTouchBegan:function (touches, event) {
                jslog("click", touches[0].getLocation().x, touches[0].getLocation().y);
            }
        }, this);

 

 
     如果把onTouchesMovied和onTouchesEnded放到不同的类中监听,则可以实现移动和点击不互相影响。

 

coco2d-js 触摸移动的同时处理点击事件,布布扣,bubuko.com

原文:http://www.cnblogs.com/kenkofox/p/3919977.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!