more sounds

This commit is contained in:
2026-03-12 02:41:08 +01:00
parent 040dc5d5e9
commit 6706d60086
86 changed files with 126 additions and 33 deletions

View File

@@ -247,11 +247,58 @@
<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/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"/> <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="sounds/808K_A.wav" preload="auto" type="audio/wav"></audio> <audio id = "btb_1" src = "snd/btb_1.ogg" preload = "auto" type = "audio/ogg"></audio>
<audio id="hardDropSound" src="sounds/909S.wav" preload="auto" type="audio/wav"></audio> <audio id = "btb_2" src = "snd/btb_2.ogg" preload = "auto" type = "audio/ogg"></audio>
<audio id="lineClearSound" src="sounds/808COW.wav" preload="auto" type="audio/wav"></audio> <audio id = "btb_3" src = "snd/btb_3.ogg" preload = "auto" type = "audio/ogg"></audio>
<audio id="tSpinSound" src="sounds/78GUIR.wav" preload="auto" type="audio/wav"></audio> <audio id = "btb_break" src = "snd/btb_break.ogg" preload = "auto" type = "audio/ogg"></audio>
<audio id="quatuorSound" src="sounds/BRRDC1.wav" preload="auto" type="audio/wav"></audio> <audio id = "clearbtb" src = "snd/clearbtb.ogg" preload = "auto" type = "audio/ogg"></audio>
<audio id = "clearline" src = "snd/clearline.ogg" preload = "auto" type = "audio/ogg"></audio>
<audio id = "clearquad" src = "snd/clearquad.ogg" preload = "auto" type = "audio/ogg"></audio>
<audio id = "clearspin" src = "snd/clearspin.ogg" preload = "auto" type = "audio/ogg"></audio>
<audio id = "combo_1_power" src = "snd/combo_1_power.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_1" src = "snd/combo_1.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_10_power" src = "snd/combo_10_power.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_10" src = "snd/combo_10.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_11_power" src = "snd/combo_11_power.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_11" src = "snd/combo_11.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_12_power" src = "snd/combo_12_power.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_12" src = "snd/combo_12.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_13_power" src = "snd/combo_13_power.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_13" src = "snd/combo_13.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_14_power" src = "snd/combo_14_power.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_14" src = "snd/combo_14.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_15_power" src = "snd/combo_15_power.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_15" src = "snd/combo_15.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_16_power" src = "snd/combo_16_power.ogg" preload = "auto" type = "audio/ogg"></audio>
<audio id = "combo_16" src = "snd/combo_16.ogg" preload = "auto" type = "audio/ogg"></audio>
<audio id = "combo_2_power" src = "snd/combo_2_power.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_2" src = "snd/combo_2.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_3_power" src = "snd/combo_3_power.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_3" src = "snd/combo_3.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_4_power" src = "snd/combo_4_power.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_4" src = "snd/combo_4.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_5_power" src = "snd/combo_5_power.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_5" src = "snd/combo_5.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_6_power" src = "snd/combo_6_power.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_6" src = "snd/combo_6.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_7_power" src = "snd/combo_7_power.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_7" src = "snd/combo_7.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_8_power" src = "snd/combo_8_power.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_8" src = "snd/combo_8.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_9_power" src = "snd/combo_9_power.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combo_9" src = "snd/combo_9.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "combobreak" src = "snd/combobreak.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "floor" src = "snd/floor.ogg" preload = "auto" type = "audio/ogg"></audio>
<audio id = "harddrop" src = "snd/harddrop.ogg" preload = "auto" type = "audio/ogg"></audio>
<audio id = "hit" src = "snd/hit.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "hold" src = "snd/hold.ogg" preload = "auto" type = "audio/ogg"></audio>
<audio id = "hyperalert" src = "snd/hyperalert.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "menuconfirm" src = "snd/menuconfirm.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "menuhover" src = "snd/menuhover.ogg" preload = "auto" type = "audio/ogg"></audio>
<audio id = "move" src = "snd/move.ogg" preload = "auto" type = "audio/ogg"></audio>
<audio id = "rotate" src = "snd/rotate.ogg" preload = "auto" type = "audio/ogg"></audio>
<audio id = "shatter" src = "snd/shatter.mp3" preload = "auto" type = "audio/mp3"></audio>
<audio id = "spin" src = "snd/spin.ogg" preload = "auto" type = "audio/ogg"></audio>
</span> </span>
<script src="js/game_logic.js" language="Javascript" type="text/javascript"></script> <script src="js/game_logic.js" language="Javascript" type="text/javascript"></script>

View File

@@ -32,6 +32,7 @@ function pauseSettings() {
document.onkeydown = null; document.onkeydown = null;
settings.show(); settings.show();
playSound(menuhover)
} }
function newGame(event) { function newGame(event) {
@@ -82,6 +83,8 @@ function resume(event) {
if (matrix.piece) scheduler.setInterval(fall, stats.fallPeriod); if (matrix.piece) scheduler.setInterval(fall, stats.fallPeriod);
else generate(); else generate();
playSound(menuconfirm)
} }
} }
@@ -103,19 +106,19 @@ function generate(piece) {
} }
let playerActions = { let playerActions = {
moveLeft: () => matrix.piece.move(TRANSLATION.LEFT), moveLeft: () => matrix.piece.move(TRANSLATION.LEFT)? playSound(move) : playSound(hit),
moveRight: () => matrix.piece.move(TRANSLATION.RIGHT), moveRight: () => matrix.piece.move(TRANSLATION.RIGHT)? playSound(move) : playSound(hit),
rotateClockwise: () => matrix.piece.rotate(ROTATION.CW), rotateClockwise: () => matrix.piece.rotate(ROTATION.CW)? playSound(rotate) : playSound(hit),
rotateCounterclockwise: () => matrix.piece.rotate(ROTATION.CCW), rotateCounterclockwise: () => matrix.piece.rotate(ROTATION.CCW)? playSound(rotate) : playSound(hit),
softDrop: () => matrix.piece.move(TRANSLATION.DOWN) && ++stats.score, softDrop: () => (matrix.piece.move(TRANSLATION.DOWN) && ++stats.score)? playSound(move) : playSound(floor),
hardDrop: function () { hardDrop: function () {
scheduler.clearTimeout(lockDown); scheduler.clearTimeout(lockDown);
playSound(hardDropSound); playSound(harddrop);
while (matrix.piece.move(TRANSLATION.DOWN, ROTATION.NONE, true)) stats.score += 2; while (matrix.piece.move(TRANSLATION.DOWN, ROTATION.NONE, true)) stats.score += 2;
matrixCard.classList.remove('hard-dropped-table-animation'); matrixCard.classList.remove('hard-dropped-table-animation');
matrixCard.offsetHeight; matrixCard.offsetHeight;
@@ -128,6 +131,7 @@ let playerActions = {
if (matrix.piece.holdEnabled) { if (matrix.piece.holdEnabled) {
scheduler.clearInterval(fall); scheduler.clearInterval(fall);
scheduler.clearTimeout(lockDown); scheduler.clearTimeout(lockDown);
playSound(hold)
let piece = matrix.piece; let piece = matrix.piece;
piece.facing = FACING.NORTH; piece.facing = FACING.NORTH;

View File

@@ -17,7 +17,7 @@ const T_SPIN = {
T_SPIN: "PIROUETTE" T_SPIN: "PIROUETTE"
} }
// score = AWARDED_LINE_CLEARS[tSpin][nbClearedLines] // score = AWARDED_LINE_CLEARS[tSpin][clearedLines]
const AWARDED_LINE_CLEARS = { const AWARDED_LINE_CLEARS = {
[T_SPIN.NONE]: [0, 1, 3, 5, 8], [T_SPIN.NONE]: [0, 1, 3, 5, 8],
[T_SPIN.MINI]: [1, 2], [T_SPIN.MINI]: [1, 2],
@@ -282,18 +282,18 @@ class Matrix extends MinoesTable {
} }
clearLines() { clearLines() {
let nbClearedLines = 0 let clearedLines = 0
for (let y=0; y<this.rows; y++) { for (let y=0; y<this.rows; y++) {
let row = this.blocks[y] let row = this.blocks[y]
if (row.filter(lockedMino => lockedMino).length == this.columns) { if (row.filter(lockedMino => lockedMino).length == this.columns) {
nbClearedLines++ clearedLines++
this.blocks.splice(y, 1) this.blocks.splice(y, 1)
this.blocks.unshift(Array(matrix.columns)) this.blocks.unshift(Array(matrix.columns))
this.table.rows[y].classList.add("cleared-line-animation") this.table.rows[y].classList.add("cleared-line-animation")
} }
} }
this.redraw() this.redraw()
return nbClearedLines return clearedLines
} }
} }
Matrix.prototype.init_center = [4, 4] Matrix.prototype.init_center = [4, 4]

View File

@@ -144,8 +144,8 @@ class Stats {
levelInput.value = localStorage['startLevel'] || 1; levelInput.value = localStorage['startLevel'] || 1;
this.score = 0; this.score = 0;
this.goal = 0; this.goal = 0;
this.combo = 0; this.combo = -1;
this.b2b = 0; this.b2b = -1;
this.startTime = new Date(); this.startTime = new Date();
this.lockDelay = DELAY.LOCK; this.lockDelay = DELAY.LOCK;
this.totalClearedLines = 0; this.totalClearedLines = 0;
@@ -231,23 +231,23 @@ class Stats {
return new Date() - this.startTime; return new Date() - this.startTime;
} }
lockDown(tSpin, nbClearedLines) { lockDown(tSpin, clearedLines) {
this.totalClearedLines += nbClearedLines; this.totalClearedLines += clearedLines;
if (nbClearedLines == 4) this.nbQuatuors++; if (clearedLines == 4) this.nbQuatuors++;
if (tSpin == T_SPIN.T_SPIN) this.nbTSpin++; if (tSpin == T_SPIN.T_SPIN) this.nbTSpin++;
// Cleared lines & T-Spin // Cleared lines & T-Spin
let awardedLineClears = AWARDED_LINE_CLEARS[tSpin][nbClearedLines]; let awardedLineClears = AWARDED_LINE_CLEARS[tSpin][clearedLines];
let patternScore = 100 * this.level * awardedLineClears; let patternScore = 100 * this.level * awardedLineClears;
if (tSpin) if (tSpin)
messagesSpan.addNewChild('div', { messagesSpan.addNewChild('div', {
className: 'rotate-in-animation', className: 'rotate-in-animation',
innerHTML: tSpin, innerHTML: tSpin,
}); });
if (nbClearedLines) if (clearedLines)
messagesSpan.addNewChild('div', { messagesSpan.addNewChild('div', {
className: 'zoom-in-animation', className: 'zoom-in-animation',
innerHTML: CLEARED_LINES_NAMES[nbClearedLines], innerHTML: CLEARED_LINES_NAMES[clearedLines],
}); });
if (patternScore) { if (patternScore) {
messagesSpan.addNewChild('div', { messagesSpan.addNewChild('div', {
@@ -259,10 +259,10 @@ class Stats {
} }
// Combo // Combo
if (nbClearedLines) { if (clearedLines) {
this.combo++; this.combo++;
if (this.combo >= 1) { if (this.combo >= 1) {
let comboScore = (nbClearedLines == 1 ? 20 : 50) * this.combo * this.level; let comboScore = (clearedLines == 1 ? 20 : 50) * this.combo * this.level;
if (this.combo == 1) { if (this.combo == 1) {
messagesSpan.addNewChild('div', { messagesSpan.addNewChild('div', {
className: 'zoom-in-animation', className: 'zoom-in-animation',
@@ -279,11 +279,12 @@ class Stats {
this.score += comboScore; this.score += comboScore;
} }
} else { } else {
if (this.combo >= 1) playSound(combobreak)
this.combo = -1; this.combo = -1;
} }
// Back to back sequence // Back to back sequence
if (nbClearedLines == 4 || (tSpin && nbClearedLines)) { if (clearedLines == 4 || (tSpin && clearedLines)) {
this.b2b++; this.b2b++;
if (this.b2b >= 1) { if (this.b2b >= 1) {
let b2bScore = patternScore / 2; let b2bScore = patternScore / 2;
@@ -302,23 +303,64 @@ class Stats {
} }
this.score += b2bScore; this.score += b2bScore;
} }
} else if (nbClearedLines && !tSpin) { } else if (clearedLines && !tSpin) {
if (this.b2b >= 1) { if (this.b2b >= 1) {
messagesSpan.addNewChild('div', { messagesSpan.addNewChild('div', {
className: 'zoom-in-animation', className: 'zoom-in-animation',
style: 'animation-delay: .4s', style: 'animation-delay: .4s',
innerHTML: `FIN DU BOUT À BOUT`, innerHTML: `FIN DU BOUT À BOUT`,
}); });
playSound(btb_break)
} }
this.b2b = -1; this.b2b = -1;
} }
// Sound // Sounds
if (sfxVolumeRange.value) { if (clearedLines == 4 || (tSpin && clearedLines)) {
if (nbClearedLines == 4) playSound(quatuorSound, this.combo); if (this.b2b >= 1) switch(this.b2b) {
else if (nbClearedLines) playSound(lineClearSound, this.combo); case 1: playSound(btb_1); break
if (tSpin) playSound(tSpinSound, this.combo); case 2: playSound(btb_2); break
} default: playSound(btb_3)
} else if (this.combo >= 1) switch(this.combo) {
case 1: playSound(combo_1_power); break
case 2: playSound(combo_2_power); break
case 3: playSound(combo_3_power); break
case 4: playSound(combo_4_power); break
case 5: playSound(combo_5_power); break
case 6: playSound(combo_6_power); break
case 7: playSound(combo_7_power); break
case 8: playSound(combo_8_power); break
case 9: playSound(combo_9_power); break
case 10: playSound(combo_10_power); break
case 11: playSound(combo_11_power); break
case 12: playSound(combo_12_power); break
case 13: playSound(combo_13_power); break
case 14: playSound(combo_14_power); break
case 15: playSound(combo_15_power); break
default: playSound(combo_16_power)
} else if (clearedLines == 4) playSound(clearbtb);
else playSound(clearspin);
} else if (this.combo >= 1) switch(this.combo) {
case 1: playSound(combo_1); break
case 2: playSound(combo_2); break
case 3: playSound(combo_3); break
case 4: playSound(combo_4); break
case 5: playSound(combo_5); break
case 6: playSound(combo_6); break
case 7: playSound(combo_7); break
case 8: playSound(combo_8); break
case 9: playSound(combo_9); break
case 10: playSound(combo_10); break
case 11: playSound(combo_11); break
case 12: playSound(combo_12); break
case 13: playSound(combo_13); break
case 14: playSound(combo_14); break
case 15: playSound(combo_15); break
default: playSound(combo_16)
} else if (tSpin) {
if (clearedLines) playSound(clearspin);
else playSound(spin);
} else if (clearedLines) playSound(clearline);
this.goal -= awardedLineClears; this.goal -= awardedLineClears;
if (this.goal <= 0) this.level++; if (this.goal <= 0) this.level++;

BIN
snd/allclear.ogg Normal file

Binary file not shown.

BIN
snd/btb_1.ogg Normal file

Binary file not shown.

BIN
snd/btb_2.ogg Normal file

Binary file not shown.

BIN
snd/btb_3.ogg Normal file

Binary file not shown.

BIN
snd/btb_break.ogg Normal file

Binary file not shown.

BIN
snd/clearbtb.ogg Normal file

Binary file not shown.

BIN
snd/clearline.ogg Normal file

Binary file not shown.

BIN
snd/clearquad.ogg Normal file

Binary file not shown.

BIN
snd/clearspin.ogg Normal file

Binary file not shown.

BIN
snd/clutch.mp3 Normal file

Binary file not shown.

BIN
snd/combo_1.mp3 Normal file

Binary file not shown.

BIN
snd/combo_10.mp3 Normal file

Binary file not shown.

BIN
snd/combo_10_power.mp3 Normal file

Binary file not shown.

BIN
snd/combo_11.mp3 Normal file

Binary file not shown.

BIN
snd/combo_11_power.mp3 Normal file

Binary file not shown.

BIN
snd/combo_12.mp3 Normal file

Binary file not shown.

BIN
snd/combo_12_power.mp3 Normal file

Binary file not shown.

BIN
snd/combo_13.mp3 Normal file

Binary file not shown.

BIN
snd/combo_13_power.mp3 Normal file

Binary file not shown.

BIN
snd/combo_14.mp3 Normal file

Binary file not shown.

BIN
snd/combo_14_power.mp3 Normal file

Binary file not shown.

BIN
snd/combo_15.mp3 Normal file

Binary file not shown.

BIN
snd/combo_15_power.mp3 Normal file

Binary file not shown.

BIN
snd/combo_16.ogg Normal file

Binary file not shown.

BIN
snd/combo_16_power.ogg Normal file

Binary file not shown.

BIN
snd/combo_1_power.mp3 Normal file

Binary file not shown.

BIN
snd/combo_2.mp3 Normal file

Binary file not shown.

BIN
snd/combo_2_power.mp3 Normal file

Binary file not shown.

BIN
snd/combo_3.mp3 Normal file

Binary file not shown.

BIN
snd/combo_3_power.mp3 Normal file

Binary file not shown.

BIN
snd/combo_4.mp3 Normal file

Binary file not shown.

BIN
snd/combo_4_power.mp3 Normal file

Binary file not shown.

BIN
snd/combo_5.mp3 Normal file

Binary file not shown.

BIN
snd/combo_5_power.mp3 Normal file

Binary file not shown.

BIN
snd/combo_6.mp3 Normal file

Binary file not shown.

BIN
snd/combo_6_power.mp3 Normal file

Binary file not shown.

BIN
snd/combo_7.mp3 Normal file

Binary file not shown.

BIN
snd/combo_7_power.mp3 Normal file

Binary file not shown.

BIN
snd/combo_8.mp3 Normal file

Binary file not shown.

BIN
snd/combo_8_power.mp3 Normal file

Binary file not shown.

BIN
snd/combo_9.mp3 Normal file

Binary file not shown.

BIN
snd/combo_9_power.mp3 Normal file

Binary file not shown.

BIN
snd/combobreak.mp3 Normal file

Binary file not shown.

BIN
snd/counter.ogg Normal file

Binary file not shown.

BIN
snd/damage_alert.ogg Normal file

Binary file not shown.

BIN
snd/damage_large.ogg Normal file

Binary file not shown.

BIN
snd/damage_medium.ogg Normal file

Binary file not shown.

BIN
snd/damage_small.ogg Normal file

Binary file not shown.

BIN
snd/death.mp3 Normal file

Binary file not shown.

BIN
snd/elim.mp3 Normal file

Binary file not shown.

BIN
snd/exchange.ogg Normal file

Binary file not shown.

BIN
snd/floor.ogg Normal file

Binary file not shown.

BIN
snd/garbage_in_large.ogg Normal file

Binary file not shown.

BIN
snd/garbage_in_medium.ogg Normal file

Binary file not shown.

BIN
snd/garbage_in_small.ogg Normal file

Binary file not shown.

BIN
snd/garbage_out_large.ogg Normal file

Binary file not shown.

BIN
snd/garbage_out_medium.ogg Normal file

Binary file not shown.

BIN
snd/garbage_out_small.ogg Normal file

Binary file not shown.

BIN
snd/garbagerise.ogg Normal file

Binary file not shown.

BIN
snd/garbagesmash.ogg Normal file

Binary file not shown.

BIN
snd/harddrop.ogg Normal file

Binary file not shown.

BIN
snd/hit.mp3 Normal file

Binary file not shown.

BIN
snd/hold.ogg Normal file

Binary file not shown.

BIN
snd/hyperalert.mp3 Normal file

Binary file not shown.

BIN
snd/menuconfirm.mp3 Normal file

Binary file not shown.

BIN
snd/menuhit1.mp3 Normal file

Binary file not shown.

BIN
snd/menuhit2.mp3 Normal file

Binary file not shown.

BIN
snd/menuhit3.mp3 Normal file

Binary file not shown.

BIN
snd/menuhover.ogg Normal file

Binary file not shown.

BIN
snd/move.ogg Normal file

Binary file not shown.

BIN
snd/offset.ogg Normal file

Binary file not shown.

BIN
snd/rotate.ogg Normal file

Binary file not shown.

BIN
snd/shatter.mp3 Normal file

Binary file not shown.

BIN
snd/spin.ogg Normal file

Binary file not shown.

BIN
snd/spinend.mp3 Normal file

Binary file not shown.

BIN
snd/topout.ogg Normal file

Binary file not shown.

BIN
snd/warning.ogg Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.