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 触摸移动的同时处理点击事件
时间: 2024-10-03 19:23:41