diff --git a/scripts/script.js b/scripts/script.js index bdd691b..59c0c1e 100644 --- a/scripts/script.js +++ b/scripts/script.js @@ -28,7 +28,7 @@ function switchTeambuilder(){ setTimeout(actuallySwitchTeambuilder, 1000) } -const songs = ["Harrisville.mp3", "Springdale.mp3", "Blossom.mp3"] +const songs = ["Harrisville.mp3", "Springdale.mp3", "Blossom.mp3", "SoAlone.mp3", "Uptown.mp3", "SanFantastico.mp3", "OldHarrisville.mp3", "Sakura.mp3"] function startGame(){ document.getElementById("startMenu").style.display = "none"; @@ -75,4 +75,12 @@ function loadMusic(){ function hidePad(){ document.getElementById("padTrans").style.animation = "fadeOut 1s"; setTimeout(intoFinished, 1000) -} \ No newline at end of file +} + +document.getElementById("bgm").addEventListener("ended", function(){ + document.getElementById("bgm").currentTime = 0; + const randomSong = Math.floor(Math.random() * songs.length); + const path = "./audios/music/" + songs[randomSong]; + document.getElementById("bgm").src = path; + document.getElementById("bgm").play() +}); \ No newline at end of file diff --git a/scripts/teambuilder.js b/scripts/teambuilder.js index e4e15a5..cee26f5 100644 --- a/scripts/teambuilder.js +++ b/scripts/teambuilder.js @@ -41,7 +41,7 @@ function toggleMusic(){ } } -const songs = ["Harrisville.mp3", "Springdale.mp3", "Blossom.mp3"] +const songs = ["Harrisville.mp3", "Springdale.mp3", "Blossom.mp3", "SoAlone.mp3", "Uptown.mp3", "SanFantastico.mp3", "OldHarrisville.mp3", "Sakura.mp3"] function setUp(){ const randomSong = Math.floor(Math.random() * songs.length); @@ -69,3 +69,11 @@ function setUp(){ document.getElementById("padTrans").style.animation = "fadeOut 1s"; setTimeout(intoFinished, 1000) } + +document.getElementById("bgm").addEventListener("ended", function(){ + document.getElementById("bgm").currentTime = 0; + const randomSong = Math.floor(Math.random() * songs.length); + const path = "./audios/music/" + songs[randomSong]; + document.getElementById("bgm").src = path; + document.getElementById("bgm").play() +});