more audio updates

This commit is contained in:
Bui 2018-08-06 11:13:01 +01:00
parent 5eac1c3f14
commit 90e461b587
6 changed files with 27 additions and 3 deletions

View File

@ -37,7 +37,15 @@ var assets = {
'combo-500.wav', 'combo-500.wav',
'combo-600.wav', 'combo-600.wav',
'combo-700.wav', 'combo-700.wav',
'song-select.wav' 'song-select.wav',
'title.ogg',
'pause.wav',
'cancel.wav',
'results.wav',
'bgm_songsel.mp3',
'bgm_results.ogg'
), ),
songs: new Array(), songs: new Array(),

View File

@ -249,12 +249,14 @@ function Game(controller, selectedSong, songData){
this.togglePause = function(){ this.togglePause = function(){
if(!_paused){ if(!_paused){
assets.sounds["pause"].play();
_paused=true; _paused=true;
_latestDate = new Date(); _latestDate = new Date();
_this.toggleMainMusic(); _this.toggleMainMusic();
} }
else{ else{
assets.sounds["cancel"].play();
_paused=false; _paused=false;
var currentDate = new Date(); var currentDate = new Date();
_ellapsedTimeSincePause = _ellapsedTimeSincePause + Math.abs(currentDate.getTime() - _latestDate.getTime()); _ellapsedTimeSincePause = _ellapsedTimeSincePause + Math.abs(currentDate.getTime() - _latestDate.getTime());

View File

@ -10,6 +10,9 @@ function loadSong(selectedSong){
this.run = function(){ this.run = function(){
assets.sounds["bgm_songsel"].pause();
assets.sounds["bgm_songsel"].currentTime = 0;
assets.sounds["start"].play(); assets.sounds["start"].play();
$("#assets").append("<img id='music-bg' src='/songs/"+_selectedSong.folder+"/bg.png' />"); $("#assets").append("<img id='music-bg' src='/songs/"+_selectedSong.folder+"/bg.png' />");

View File

@ -71,15 +71,23 @@ function Scoresheet(controller, score){
} }
this.run = function(){ this.run = function(){
assets.sounds["results"].play();
assets.sounds["bgm_results"].volume = 1;
assets.sounds["bgm_results"].play();
_this.positionning(); _this.positionning();
_this.setResults(); _this.setResults();
$("#song-select").click(function(){ $("#song-select").click(function(){
assets.sounds["bgm_results"].pause();
assets.sounds["bgm_songsel"].currentTime = 0;
controller.songSelection(); controller.songSelection();
}); });
$("#replay").click(function(){ $("#replay").click(function(){
assets.sounds["bgm_results"].pause();
assets.sounds["bgm_songsel"].currentTime = 0;
controller.restartSong(); controller.restartSong();
}); });

View File

@ -51,6 +51,7 @@ function SongSelect(){
this.createCode = function(){ this.createCode = function(){
assets.sounds["bgm_songsel"].play();
assets.sounds["song-select"].play(); assets.sounds["song-select"].play();
for(var i=0; i<assets.songs.length; i++){ for(var i=0; i<assets.songs.length; i++){

View File

@ -32,6 +32,8 @@ function Titlescreen(){
$("#screen").find("#title-screen").show(); $("#screen").find("#title-screen").show();
$(window).resize(_this.positionning); $(window).resize(_this.positionning);
assets.sounds["title"].play();
} }
this.goNext = function(){ this.goNext = function(){