Skip to content

Commit

Permalink
Make music playing looped
Browse files Browse the repository at this point in the history
  • Loading branch information
EntityPlantt committed Nov 21, 2022
1 parent c33c117 commit e049921
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,14 @@ var GUI = {
};
onload = () => {
window.music = new Audio("music.mp3");
onclick = () => {
function playMusic() {
music.play();
onclick = null;
music.onended = () => {
music.play();
}
removeEventListener("click", playMusic);
}
addEventListener("click", playMusic);
window.gameSettings = JSON.parse(localStorage.getItem("game-settings")) ?? {volume: 75, highRenderQuality: false};
music.volume = gameSettings.volume / 100;
window.closeButton = document.createElement("div");
Expand Down

0 comments on commit e049921

Please sign in to comment.