Skip to content

Instantly share code, notes, and snippets.

@nathanpc
Created January 8, 2012 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanpc/1578631 to your computer and use it in GitHub Desktop.
Save nathanpc/1578631 to your computer and use it in GitHub Desktop.
Non-Working Movement Script
var basketx = 0;
var basket = 4;
var t;
function loaded() {
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
var s = (window.innerWidth / 2) - (128 / 2);
t = self.setInterval("moveBasket('" + s + "')", 10);
}
function moveBasket(x) {
if (basketx != x) {
$("#basket").css("left", basket * 16 + "px");
basket = basketx++ /8;
console.log("basketx: " + basketx + " - basket: " + basket);
} else if (basketx == x) {
t = window.clearInterval(t);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment