Skip to content

Commit

Permalink
修改 在手机上游戏 同时按住两个方向键的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoyuexing committed Sep 29, 2018
1 parent c111898 commit d9cd5f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 0 additions & 1 deletion assets/prefab/Player.prefab.meta
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"ver": "1.0.0",
"uuid": "60845243-f385-4a94-bb9e-05faa5bed6cf",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"subMetas": {}
}
16 changes: 11 additions & 5 deletions assets/scripts/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,29 +141,35 @@ cc.Class({
}

},

//2.0 需要手动移除
addEventManageListener :function() {
console.log("addEventManageListener");
var self = this
if (this.mouseListener != null) {
cc.eventManager.removeListener(this.mouseListener);
}
this.mouseListener = cc.eventManager.addListener({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
fakeMove: Number,
fakeMove: null,
onTouchBegan: function (touch, event) {
console.log("begin move ");
self.onTouch(touch);
this.fakeMove = setInterval(function () {
self.onTouch(touch);
},GLB.FPS);
if (this.fakeMove == null) {
this.fakeMove = setInterval(function () {
self.onTouch(touch);
},GLB.FPS);
}
return true;
},
onTouchMoved: function (touch) {
// onTouch(touch);
return true;
},
onTouchEnded: function (touch, event) {
console.log("begin let go");
clearInterval(this.fakeMove);
this.fakeMove = null;
self.isUserInputing = GLB.ARROW_STOP;
self.onPostionChanged(self.playerSpriteRight.node.x, self.isUserInputing);
}
Expand Down

0 comments on commit d9cd5f6

Please sign in to comment.