Skip to content

Instantly share code, notes, and snippets.

@ndugger
Created June 3, 2018 20:10
Show Gist options
  • Save ndugger/0900544abeb7108123f1282dbcf3eb96 to your computer and use it in GitHub Desktop.
Save ndugger/0900544abeb7108123f1282dbcf3eb96 to your computer and use it in GitHub Desktop.
const entities = [ ... ]
function update () {
setTimeout(() => update(), 1000 / 60);
for (const entity of entities) {
entity.update();
}
}
function draw () {
requestAnimationFrame(() => draw());
for (const entity of entities) {
entity.draw();
}
}
function startGameLoop () {
update();
draw();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment