Skip to content

Commit

Permalink
Fill progress bars to show progress when game ends
Browse files Browse the repository at this point in the history
  • Loading branch information
pcprince committed Aug 22, 2024
1 parent 19c4ecf commit 84f80a2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 4 additions & 2 deletions js/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

/* global connectToPlayer, endTimer, playAll, stopClip */
/* global playClipButtons, startTimerButton, helpButton, guessInput, giveUpButton, remakeButton */
/* global unguessedClips, unguessedArtistClips, revealSong, revealArtist, resetStartModal, isArtistMode */
/* global songClips */
/* global revealSong, revealArtist, resetStartModal, isArtistMode, fillAllBars */
/* global unguessedClips, unguessedArtistClips, songClips */

const scoreSpan = document.getElementById('score-span');
const maxScoreSpan = document.getElementById('max-score-span');
Expand Down Expand Up @@ -99,6 +99,8 @@ function endGame () {

}

fillAllBars();

stopClip();

guessInput.disabled = true;
Expand Down
12 changes: 12 additions & 0 deletions js/progressBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,18 @@ function updateProgressBarUI () {

}

function fillAllBars () {

for (let i = 0; i < progressBars.length; i++) {

progressBars[i].style.width = '100%';
progressBars[i].classList.remove('progress-bar-animated', 'bg-current');
colourProgressBar(i);

}

}

function fillBar (percentage) {

progressBars[currentClipIndex].style.width = percentage + '%';
Expand Down

0 comments on commit 84f80a2

Please sign in to comment.