const floor = Math.floor; const max = Math.max; const min = Math.min; class MyGame extends Game { constructor(canvas) { super(canvas, 320, 240); this.data = { sound: "snd/test.ogg", world: "json/world.json", player: "img/player.png" }; this.dataSize = Object.keys(this.data).length; } init() { /* log the JSON */ console.log(this.res.world); } update(dt) { } draw() { /* draw an image */ this.ctx.drawImage(this.res.player, 0, 0); /* play a sound then z is pressed */ if (this.keys["a"]) { this.playSnd(this.res.sound); } } }