Skip to content

Commit

Permalink
增加触摸点击时间
Browse files Browse the repository at this point in the history
增加触摸点击时间
  • Loading branch information
targetkiller committed May 12, 2014
1 parent 6077fb2 commit be48123
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions game.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ window.onkeydown = function (e) {
}
};

// 鼠标或触摸响应.......................................................
document.addEventListener('touchstart',function(ev){
if(ev.touches[0].pageX>climbUp.Bwidth/2){
climbUp.roleX = climbUp.toLeft;
}
else{
climbUp.roleX = climbUp.toRight;
}
},false);

var ClimbUp = function(){
// init ---------------------------
this.canvas = document.getElementById('game'),
Expand Down

0 comments on commit be48123

Please sign in to comment.