小白请教各路神仙
this.node.on(‘touchstart’,function () {
if ((cc.view.getVisibleSize().width / 2) > cc.Event.EventTouch.getLocationX()) {
……
}
}
运行后控制台会显示Simulator: 73:TypeError: cc.Event.EventTouch.getLocationX is not a function
正确代码应怎么书写?
this.node.on(‘touchstart’, function(event) {
var touches = event.getTouches();
var x = touches[0].getLocationX();
}, this);