"use strict"; var canvasWidth = 1280; var canvasHeight = 650; var c = undefined var ctx = undefined var game = { level: 1, speed: 1, gameOver: false, frames: 0, timer: 0, } window.onload = function () { init() } function init() { c = document.getElementById("canvas"); ctx = c.getContext('2d'); document.addEventListener('keydown', keyDownPressed, false); document.addEventListener('keyup', keyUpPressed, false); gameLoop(); } function keyDownPressed(e){ } function keyUpPressed(e){ } function clearGame() { ctx.clearRect(0, 0, canvasWidth, canvasHeight); } function updateGame() { game.frames++; } function drawGame() { } function gameLoop(timestamp){ clearGame(); updateGame(); drawGame(); window.requestAnimationFrame(gameLoop); }