【已解决】请各位大佬指点 pDistance函数问题

如图,不知道哪里的问题


下面是程序截图

你这个how_move是移动事件?
let touches = e.getTouches();
let dian = touches[0].getLocation();
改成这样

cc.pDistance里面要传2个Vec2,你的this.this_posi有问题,this指向的东西错了,所以this.this_posi是undefined,所以没有x属性,就会报错

谢谢大佬,我把this_posi改成全局就解决了

谢谢大佬

不用改,直接bind(this)

this.node.on(‘touchmove’,this.How_move.bind(this), this.node)