diff --git a/app.js b/app.js index e2adafe..952e751 100644 --- a/app.js +++ b/app.js @@ -330,11 +330,15 @@ class Tetromino { } matrix.drawPiece() return true - } else if (translation == TRANSLATION.DOWN) { - this.locked = true - if (!scheduler.timeoutTasks.has(lockDown)) - scheduler.setTimeout(lockDown, stats.lockDelay) - matrix.drawPiece() + } else { + if (translation == TRANSLATION.DOWN) { + this.locked = true + if (!scheduler.timeoutTasks.has(lockDown)) + scheduler.setTimeout(lockDown, stats.lockDelay) + matrix.drawPiece() + } else { + wallSound.play() + } } } @@ -744,10 +748,9 @@ Stats.prototype.timeFormat = new Intl.DateTimeFormat("fr-FR", { timeZone: "UTC" }) -function playSound(audio) { - audio.currentTime = 0 - audio.volume = sfxVolumeRange.value - audio.play() +function playSound(sound) { + sound.currentTime = 0 + sound.play() } @@ -833,6 +836,8 @@ function resume(event) { settings.form.classList.add('was-validated') if (settings.form.checkValidity()) { + for(const sound of document.getElementsByTagName("audio")) sound.volume = sfxVolumeRange.value + settings.modal.hide() settings.getInputs() @@ -871,9 +876,7 @@ let playerActions = { rotateCounterclockwise: () => matrix.piece.rotate(ROTATION.CCW), - softDrop: function() { - if (matrix.piece.move(TRANSLATION.DOWN)) stats.score++ - }, + softDrop: () => {if (matrix.piece.move(TRANSLATION.DOWN)) stats.score++}, hardDrop: function() { scheduler.clearTimeout(lockDown) diff --git a/index.html b/index.html index f8bc494..ccb223c 100644 --- a/index.html +++ b/index.html @@ -208,7 +208,8 @@ - + + diff --git a/sound/808K_A.wav b/sound/808K_A.wav new file mode 100644 index 0000000..923a584 Binary files /dev/null and b/sound/808K_A.wav differ