wall sound

This commit is contained in:
Adrien MALINGREY 2023-12-03 03:15:33 +01:00
parent c010ccba49
commit ee4945bb27
3 changed files with 17 additions and 13 deletions

19
app.js
View File

@ -330,11 +330,15 @@ class Tetromino {
}
matrix.drawPiece()
return true
} else if (translation == TRANSLATION.DOWN) {
} 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)

View File

@ -208,6 +208,7 @@
<img src="favicons/T-0.png"/><img src="favicons/T-1.png"/><img src="favicons/T-2.png"/><img src="favicons/T-3.png"/>
<img src="favicons/Z-0.png"/><img src="favicons/Z-1.png"/><img src="favicons/Z-2.png"/><img src="favicons/Z-3.png"/>
<audio id="wallSound" src="sound/808K_A.wav" preload="auto" type="audio/wav"></audio>
<audio id="hardDropSound" src="sound/808T_A.wav" preload="auto" type="audio/wav"></audio>
<audio id="tSpinSound" src="sound/HIGHQ_A.wav" preload="auto" type="audio/wav"></audio>
<audio id="lineClearSound" src="sound/HIGHQ_B.wav" preload="auto" type="audio/wav"></audio>

BIN
sound/808K_A.wav Normal file

Binary file not shown.