getLocation 获取当前触点位置。
getLocationX 获取当前触点 X 轴位置。
getLocationY 获取当前触点 Y 轴位置。
getPreviousLocation 获取触点在上一次事件时的位置对象,对象包含 x 和 y 属性。
getStartLocation 获获取触点落下时的位置对象,对象包含 x 和 y 属性。
getDelta 获取触点距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
getLocationInView 获取当前事件在游戏窗口内的坐标位置对象,对象包含 x 和 y 属性。
getPreviousLocationInView 获取触点在上一次事件时在游戏窗口中的位置对象,对象包含 x 和 y 属性。
getStartLocationInView 获取触点落下时在游戏窗口中的位置对象,对象包含 x 和 y 属性。
getID 触点的标识 ID,可以用来在多点触摸中跟踪触点。
setTouchInfo 设置触摸相关的信息。用于监控触摸事件。
getCurrentTarget 获取当前目标节点
onTouchBegan:function(touch,event){
//得到父节点游戏结束
if (that.getParent.Gameover===true)return;
var target = event.getCurrentTarget();
//把当前触点位置转换成当前目标节点
var locationInNode = target.convertToNodeSpace(touch.getLocation());
var s=target.getContentSize();
var rect=cc.rect(0,0, s.width, s.height);
if (cc.rectContainsPoint(rect,locationInNode))return true;
return false;
},
convertToNodeSpace将一个点转换到节点 (局部) 坐标系