better input

This commit is contained in:
garrettdreyfus 2014-05-24 22:44:23 -04:00
parent 303bf084db
commit 8db46856f7
2 changed files with 15 additions and 30 deletions

View file

@ -17,22 +17,6 @@ keypress.register_combo({
}
});
keypress.register_combo({
keys: "enter",
on_keydown: function() {
var shouldAnimLoop = 0;
if (gameState === -1) {
shouldAnimLoop = 1;
}
init();
if (shouldAnimLoop) {
requestAnimFrame(animLoop);
}
}
});
keypress.register_combo({
keys: "p",
on_keydown: function() {
@ -67,17 +51,18 @@ keypress.register_combo({
}
});
var tapLeft = Hammer(document.getElementById("leftTap")).on("tap", function(event) {
if (gameState != 1) {
init();
}
MainClock.rotate(1);
document.body.addEventListener('touchstart', function(e){
});
var tapRight = Hammer(document.getElementById("rightTap")).on("tap", function(event) {
if (gameState != 1) {
init();
}
MainClock.rotate(-1);
});
if( e.changedTouches[0].pageX<window.innerWidth/2){
if (gameState != 1 && gameState != -2) {
init();
}
MainClock.rotate(1);
}
if( e.changedTouches[0].pageX>window.innerWidth/2){
if (gameState != 1 && gameState != -2) {
init();
}
MainClock.rotate(-1);
}
}, false)

View file

@ -330,4 +330,4 @@ function checkGameOver() {
// window.onblur = function (e) {
// if (gameState == 1) gameState = -1;
// }
// }