cocos creator触摸事件 cc.node.EventType
来源:互联网 发布:网络语言酱紫什么意思 编辑:程序博客网 时间:2024/05/08 00:18
var sprite = myholds.children[i].getComponent(cc.Sprite); var _x = 0; var _y = 0; sprite.node.on(cc.Node.EventType.TOUCH_START, function(e){ console.log( "cc.Node.EventType.TOUCH_START" ); if(e.target == this._selectedMJ){ return false; } if(this._selectedMJ != null){ } this._selectedMJ = e.target;; return true; }.bind(this), this ); sprite.node.on(cc.Node.EventType.TOUCH_MOVE, function(e){ console.log( "cc.Node.EventType.TOUCH_MOVE" ); var move_x = e.touch._point.x - e.touch._prevPoint.x; var move_y = e.touch._point.y - e.touch._prevPoint.y; if ( this._selectedMJ != null ) { this._selectedMJ.x = this._selectedMJ.x + move_x; this._selectedMJ.y = this._selectedMJ.y + move_y; } }.bind(this), this ); sprite.node.on(cc.Node.EventType.TOUCH_END, function(e){ console.log( "cc.Node.EventType.TOUCH_END" ); if( this._selectedMJ != null ) { if( (this._selectedMJ.y - _y) > 30 ) { } else { } } }.bind(this), this ); sprite.node.on(cc.Node.EventType.TOUCH_CANCEL, function(e){ if( this._selectedMJ != null ) { if( (this._selectedMJ.y - _y) > 30 ) { } else { } } }.bind(this), this);
s事件的处理。但是在移动的时候回出现问题。就是随之移动的距离加长,会出现,手指脱离触摸的对象的问题,而此时松手会调用 TOUCH_CANCEL这个事件。
为什么让对象随着触摸点的移动而移动时,会出现脱离的情况呢??
这个待解决。
还有一个问题:打包发布ios更新的时候,触摸事件不知道为什么没能调用。。。
1 0
- cocos creator触摸事件 cc.node.EventType
- cocos creator 触摸捕捉事件
- cocos creator学习(七)触摸和键盘事件总结
- Cocos Creator 点击事件
- Cocos Creator 自定义事件
- cocos creator 事件集合
- Cocos Creator 自定义事件
- Cocos Creator 点击事件
- cocos 动画 触摸事件
- cocos-js触摸事件
- Cocos creator cc.loader.loadRes 动态加载
- cocos creator的事件处理.
- cocos creator -- 指定自定义事件
- cocos creator的自定义事件
- cocos Creator自定义事件机制
- cocos lua 3.0 触摸事件
- cocos lua 注册触摸事件
- Cocos Creator 使用 cc.Class 声明类型(摘自官方文档)
- 1093. Count PAT's (25)
- 硬连接(hard link)和软连接(symbolic link)
- 变量.注意内部链接全局变量(也声明使用静态关键字)
- Shell学习笔记
- 欢迎中央巡视组进驻北京大学,帮助领导改变官僚校风,有错必纠
- cocos creator触摸事件 cc.node.EventType
- CTF常见php猥琐小段代码审计
- PAT A1099. Build A Binary Search Tree (30)
- http请求获取json字符串的方法
- 爬取抗压吧的《猪狗恩仇录》
- C++算法题_第一周
- Dubbo|Dubbox 源码解读略析
- java安全架构____java HMAC加密
- 50个很棒的python模块