var dirty = false;
var simulate = function() { /* setTimeout(simulate, 1000/60); */
if (...) { dirty = true; }
}
var animate = function() { /* requestAnimationFrame(animate) */
if (!dirty) { return; }
dirty = false;
redraw();
}
var supported = !!window.Audio && !firefox_on_linux
new Audio().canPlayType("audio/ogg") ? "ogg" : "mp3"
new Audio(file).play()
Number.prototype.mod = function(n) {
return ((this % n) + n) % n;
}
AI.prototype.init = function(ship) {
this.originalTick = ship.tick;
ship.tick = this.tick;
}
AI.prototype.tick = function() {
/* ... */
this.originalTick();
}