Improved sound managment
This commit is contained in:
parent
1d6e12611a
commit
849e23ee5d
|
@ -42,14 +42,18 @@ Coin.prototype.get = function() {
|
||||||
Coin.total ++;
|
Coin.total ++;
|
||||||
Coin.nextSound.play();
|
Coin.nextSound.play();
|
||||||
if (Coin.total === 9) {
|
if (Coin.total === 9) {
|
||||||
var audio = new Audio('/static/data/music/starappears.mp3');
|
// You got the last coin
|
||||||
audio.play();
|
setTimeout(function() {Coin.lastSound.play();}, Coin.nextSound.duration + 1000);
|
||||||
} else {
|
} else {
|
||||||
Coin.nextSound = new Audio('/static/data/music/redcoins/' + Coin.total + '.mp3');
|
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.total = 1;
|
||||||
Coin.BASIC_MESH = null;
|
Coin.BASIC_MESH = null;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue