cocos2djs3.6 自己写个2048游戏
在用浏览器调试时一切正常:截图如下。
代码如下:
cc.eventManager.addListener({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
swallowTouches: false,
onTouchBegan: this.onTouchBegan.bind(this),
onTouchMoved: this.onTouchMoved.bind(this),
onTouchEnded: this.onTouchEnded.bind(this)
}, this);
onTouchBegan:function(touch, event){
if(this.gamelayer.isOver){
return false;
}
this.beginPos.x = touch._point.x;
this.beginPos.y = touch._point.y;
this.testLabel.setString(touch._point.x);
return true;
},
onTouchMoved:function(touch, event){
this.testLabel.setString(touch._point.x);
return true;
},
onTouchEnded:function(touch, event){
}
但是生产安卓包在手机运行的时候,怎么触摸都没有反应了,除了上面的那个new game 按钮还能用之外,上面代码添加的事件就失效了
不知道有没有人也遇到这种情况,希望有人能帮忙解答
文章内容少于10个字