24 lines
278 B
JavaScript
24 lines
278 B
JavaScript
let game, context;
|
|
|
|
init();
|
|
loop();
|
|
|
|
function init() {
|
|
|
|
let canvas = document.getElementById('canvas');
|
|
game = new Game(canvas);
|
|
|
|
}
|
|
|
|
function loop() {
|
|
|
|
// Manage physics
|
|
game.update();
|
|
|
|
// Do rendering
|
|
game.render();
|
|
|
|
requestAnimationFrame(loop);
|
|
}
|
|
|