Sound gestion improved
This commit is contained in:
parent
b868c2598c
commit
524ba0f9a8
@ -39,7 +39,7 @@ function Controller(selectedSong, songData){
|
|||||||
_game.updateTime();
|
_game.updateTime();
|
||||||
_view.refresh();
|
_view.refresh();
|
||||||
}
|
}
|
||||||
else if(ms>=0 && !started){ //when music starts
|
else if(ms>=0 && !started){ //when music shall starts
|
||||||
assets.sounds["main-music"].play();
|
assets.sounds["main-music"].play();
|
||||||
started=true;
|
started=true;
|
||||||
}
|
}
|
||||||
@ -93,9 +93,9 @@ function Controller(selectedSong, songData){
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.restartSong = function(){
|
this.restartSong = function(){
|
||||||
_game.pauseSound("main-music", true);
|
assets.sounds["main-music"].pause();
|
||||||
|
assets.sounds["main-music"].currentTime=0;
|
||||||
clearInterval(_mainLoop);
|
clearInterval(_mainLoop);
|
||||||
//songData.circles.forEach(function(circle){
|
|
||||||
$("#screen").load("/src/views/game.html", function(){
|
$("#screen").load("/src/views/game.html", function(){
|
||||||
var taikoGame = new Controller(selectedSong, songData);
|
var taikoGame = new Controller(selectedSong, songData);
|
||||||
taikoGame.run();
|
taikoGame.run();
|
||||||
|
@ -222,11 +222,11 @@ function Game(controller, selectedSong, songData){
|
|||||||
|
|
||||||
this.toggleMainMusic = function(){
|
this.toggleMainMusic = function(){
|
||||||
if(_mainMusicPlaying){
|
if(_mainMusicPlaying){
|
||||||
_soundSystem.pauseSound("main-music", false);
|
assets.sounds["main-music"].pause();
|
||||||
_mainMusicPlaying=false;
|
_mainMusicPlaying=false;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
_soundSystem.playSound("main-music");
|
assets.sounds["main-music"].play();
|
||||||
_mainMusicPlaying=true;
|
_mainMusicPlaying=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,11 +29,6 @@ function soundSystem(controller){
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.pauseSound = function(soundID, stop){
|
|
||||||
_sounds[soundID].pause();
|
|
||||||
if(stop) _sounds[soundID].currentTime=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.fadeOutMusic = function(){
|
this.fadeOutMusic = function(){
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user