Cocoscreator节点跟随鼠标移动代码
onLoad () {
this.node.on('touchstart',this.onTouchStart,this);
this.node.on('touchmove',this.onTouchMove,this);
},
onDestroy(){
this.node.off('touchstart',this.onTouchStart,this);
},
onTouchStart(e){
console.log('点击开始');
},
onTouchMove(e){
let delta=e.getDelta();
this.node.x+=delta.x;
this.node.y+=delta.y;
},