diff --git a/static/js/prototype/Coin.js b/static/js/prototype/Coin.js index 1f97938..38ee8e1 100644 --- a/static/js/prototype/Coin.js +++ b/static/js/prototype/Coin.js @@ -42,14 +42,18 @@ Coin.prototype.get = function() { Coin.total ++; Coin.nextSound.play(); if (Coin.total === 9) { - var audio = new Audio('/static/data/music/starappears.mp3'); - audio.play(); + // You got the last coin + setTimeout(function() {Coin.lastSound.play();}, Coin.nextSound.duration + 1000); } else { Coin.nextSound = new Audio('/static/data/music/redcoins/' + Coin.total + '.mp3'); + Coin.nextSound.preload = "auto"; } } } +Coin.lastSound = new Audio('/static/data/music/starappears.mp3'); +Coin.lastSound.preload = "auto"; + Coin.total = 1; Coin.BASIC_MESH = null;