您的位置:首页 > Web前端 > JavaScript

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

2014-08-18 17:08 302 查看
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放到不同的类中监听,则可以实现移动和点击不互相影响。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: