this.node.on(cc.Node.EventType.TOUCH_START, function(t){ console.log( "x" + t.getLocation().x + "y" + t.getLocation().y ) console.log(t.getLocation()) },this) this.node.on(cc.Node.EventType.TOUCH_MOVE, function(t){ console.log( "x" + t.getLocation().x + "y" + t.getLocation().y ) console.log(t.getLocation()) },this) this.node.on(cc.Node.EventType.TOUCH_END, function(t){ console.log( "x" + t.getLocation().x + "y" + t.getLocation().y ) console.log(t.getLocation()) },this) this.node.on(cc.Node.EventType.TOUCH_CANCEL, function(t){ console.log( "x" + t.getLocation().x + "y" + t.getLocation().y ) console.log(t.getLocation()) },this)
代码需要放入onLoad函数内才可生效
function(t) 函数内 t 参数为 Touch类型
Touch 类型