diff --git a/app.js b/app.js index 13abbe9..f8b674b 100644 --- a/app.js +++ b/app.js @@ -638,6 +638,23 @@ class Stats { if (nbClearedLines == 4) this.nbQuatuors++ if (tSpin == T_SPIN.T_SPIN) this.nbTSpin++ + // Sound + if (sfxVolumeRange.value) { + if (nbClearedLines == 4 || (nbClearedLines && tSpin)) { + quatuorSound.currentTime = 0 + quatuorSound.volume = sfxVolumeRange.value + quatuorSound.play() + } else if (nbClearedLines) { + lineClearSound.currentTime = 0 + lineClearSound.volume = sfxVolumeRange.value + lineClearSound.play() + } else if (tSpin) { + tSpinSound.currentTime = 0 + lineClearSound.volume = sfxVolumeRange.value + tSpinSound.play() + } + } + // Cleared lines & T-Spin let awardedLineClears = AWARDED_LINE_CLEARS[tSpin][nbClearedLines] let patternScore = 100 * this.level * awardedLineClears @@ -861,6 +878,9 @@ let playerActions = { scheduler.clearTimeout(lockDown) while (matrix.piece.move(TRANSLATION.DOWN, ROTATION.NONE, "trail-animation")) stats.score +=2 matrix.table.classList.add("hard-dropped-table-animation") + hardDropSound.currentTime = 0 + hardDropSound.volume = sfxVolumeRange.value + hardDropSound.play() lockDown() }, diff --git a/index.html b/index.html index 2e130b1..2c08309 100644 --- a/index.html +++ b/index.html @@ -56,18 +56,21 @@
ms
+
+ Volume + +
+
Interface -
- -
+
Partie @@ -207,6 +210,11 @@ + + + + + diff --git a/sound/808T_A.wav b/sound/808T_A.wav new file mode 100644 index 0000000..77ff6af Binary files /dev/null and b/sound/808T_A.wav differ diff --git a/sound/HIGHQ_A.wav b/sound/HIGHQ_A.wav new file mode 100644 index 0000000..92d3a3d Binary files /dev/null and b/sound/HIGHQ_A.wav differ diff --git a/sound/HIGHQ_B.wav b/sound/HIGHQ_B.wav new file mode 100644 index 0000000..c94e2f1 Binary files /dev/null and b/sound/HIGHQ_B.wav differ diff --git a/sound/HIGHQ_C.wav b/sound/HIGHQ_C.wav new file mode 100644 index 0000000..385af59 Binary files /dev/null and b/sound/HIGHQ_C.wav differ