diff --git a/js/entities.js b/js/entities.js index ad2eb09..4b5331b 100644 --- a/js/entities.js +++ b/js/entities.js @@ -49,6 +49,10 @@ function Block(lane, color, distFromHex, settled) { }; } +var colorSounds = {"#e74c3c": new Audio("../sounds/lowest.ogg"), + "#f1c40f":new Audio("../sounds/highest.ogg"), + "#3498db":new Audio("../sounds/middle.ogg") +}; function Clock(sideLength) { this.fillColor = '#2c3e50'; @@ -76,6 +80,11 @@ function Clock(sideLength) { block.distFromHex = MainClock.sideLength / 2 * Math.sqrt(3) + block.height * this.blocks[lane].length; this.blocks[lane].push(block); consolidateBlocks(this, lane, this.blocks[lane].length - 1); + if (window.chrome) { + colorSounds[block.color].load(); + } + colorSounds[block.color].play(); + }; this.doesBlockCollide = function(block, iter, position, tArr) { diff --git a/sounds/highest.ogg b/sounds/highest.ogg new file mode 100755 index 0000000..b44c20c Binary files /dev/null and b/sounds/highest.ogg differ diff --git a/sounds/highest.wav b/sounds/highest.wav new file mode 100644 index 0000000..beebd93 Binary files /dev/null and b/sounds/highest.wav differ diff --git a/sounds/lowest.ogg b/sounds/lowest.ogg new file mode 100755 index 0000000..70b4790 Binary files /dev/null and b/sounds/lowest.ogg differ diff --git a/sounds/lowest.wav b/sounds/lowest.wav new file mode 100644 index 0000000..efe81f3 Binary files /dev/null and b/sounds/lowest.wav differ diff --git a/sounds/middle.ogg b/sounds/middle.ogg new file mode 100755 index 0000000..12779bc Binary files /dev/null and b/sounds/middle.ogg differ diff --git a/sounds/middle.wav b/sounds/middle.wav new file mode 100644 index 0000000..17ff414 Binary files /dev/null and b/sounds/middle.wav differ