no sound if volume = 0

This commit is contained in:
Adrien MALINGREY 2023-05-16 23:36:24 +02:00
parent 2aec3e55d9
commit 2411416b01

4
app.js

@ -1107,10 +1107,10 @@ function lockDown() {
let nbClearedLines = matrix.clearLines() let nbClearedLines = matrix.clearLines()
if (nbClearedLines == 4 || (nbClearedLines && tSpin)) { if (nbClearedLines == 4 || (nbClearedLines && tSpin)) {
tetrisSound.currentTime = 0 tetrisSound.currentTime = 0
tetrisSound.play() if (tetrisSound.volume) tetrisSound.play()
} else if (nbClearedLines || tSpin) { } else if (nbClearedLines || tSpin) {
lineClearSound.currentTime = 0 lineClearSound.currentTime = 0
lineClearSound.play() if(lineClearSound.volume) lineClearSound.play()
} }
stats.lockDown(nbClearedLines, tSpin) stats.lockDown(nbClearedLines, tSpin)