Created
June 3, 2018 20:10
-
-
Save ndugger/0900544abeb7108123f1282dbcf3eb96 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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