3.4版本
想问下哪里有对应的文档或者demo
2d还是3d?触摸事件不会还是移动功能不会?谁知道你要问啥
哈哈哈 我也没看懂 也就没理 
我本来都回复了,但仔细一看需要回的太多了,就删了 
我猜他想要虚拟摇杆
抱歉,2D,监控手指上滑 下滑 左滑 右滑的事件,求个demo
//添加touch事件
addClick()
{
this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this)
this.node.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this)
this.node.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this)
this.node.on(cc.Node.EventType.TOUCH_CANCEL, this.onTouchCancel, this)
}
//移除touch事件
offClick()
{
this.node.off(cc.Node.EventType.TOUCH_START, this.onTouchStart, this)
this.node.off(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this)
this.node.off(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this)
this.node.off(cc.Node.EventType.TOUCH_CANCEL, this.onTouchCancel, this)
}
//点击
onTouchStart()
{
// 点击开始的处理
}
//移动
onTouchMove(event: cc.Event.EventTouch)
{
//移动
let _pos = event.touch.getDelta()
需要移动的物体.x += _pos.x
需要移动的物体.y += _pos.y
}
//松开
onTouchEnd()
{
//根据情况做处理
}
//按下状态离开节点
onTouchCancel()
{
//根据情况做处理
}
感谢 我试试 想知道官方有没有类似的demo啊?
OK 我试试 二者比对了解
还有一点不是很清楚,坐标从左上滑到右下 这个方向应该是向右 还是向下呢?
想知道有没有一个标准?
x-x y-y 哪个大默认往哪
好嘞 谢谢 !!!
