I'm trying to make a HTML5 game that I've built for web compatible with iOS touches instead of using the left and right keys on the keyboard. What is the best way to access touches in the same way as onkeyup?
Code for the onkeyup:
document.onkeyup = function(e) {
var key = e.keyCode;
if (key == 37) {
dir = "left";
player.isMovingLeft = false;
} else if (key == 39) {
dir = "right";
player.isMovingRight = false;
}
};