|
|
@@ -8,6 +8,7 @@ var assets = { |
|
|
|
background: new ImageSource("background", null, ".jpg"), |
|
|
|
wall: new ImageSource("wall"), |
|
|
|
wall_overlap: new ImageSource("wall-overlap"), |
|
|
|
powerup: new ImageSource("powerup"), |
|
|
|
}, |
|
|
|
|
|
|
|
audio: { |
|
|
@@ -32,8 +33,14 @@ function AudioSource(src, ext) { |
|
|
|
var ext = ext || ".mp3"; |
|
|
|
|
|
|
|
this.elems = []; |
|
|
|
for (var i = 0; i < 10; ++i) |
|
|
|
for (var i = 0; i < 10; ++i) { |
|
|
|
this.elems[i] = new Audio(commonPath+"/"+src+ext); |
|
|
|
|
|
|
|
this.elems[i].addEventListener("ended", function() { |
|
|
|
this.emit("ended"); |
|
|
|
}.bind(this)); |
|
|
|
} |
|
|
|
|
|
|
|
this.ready = false; |
|
|
|
this.index = 0; |
|
|
|
|
|
|
@@ -45,10 +52,6 @@ function AudioSource(src, ext) { |
|
|
|
this.emit("load"); |
|
|
|
}.bind(this)); |
|
|
|
|
|
|
|
this.elems[0].addEventListener("ended", function() { |
|
|
|
this.emit("ended"); |
|
|
|
}.bind(this)); |
|
|
|
|
|
|
|
this.elems[0].onerror = function() { |
|
|
|
console.error("Error with", src); |
|
|
|
} |