cc.Class({
extends: cc.Component,
properties: {
},
start () {
//注册Touch事件
this.node.on(cc.Node.EventType.TOUCH_START,this.touchBegin,this);
},
//实现物体移动至Touch的位置
touchBegin:function(event)
{
let sp = cc.find('sprite_splash');
if (sp) {
sp.position = event.getLocation();
}
}
});