more sounds
This commit is contained in:
+52
-5
@@ -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/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="hardDropSound" src="sounds/909S.wav" preload="auto" type="audio/wav"></audio>
|
||||
<audio id="lineClearSound" src="sounds/808COW.wav" preload="auto" type="audio/wav"></audio>
|
||||
<audio id="tSpinSound" src="sounds/78GUIR.wav" preload="auto" type="audio/wav"></audio>
|
||||
<audio id="quatuorSound" src="sounds/BRRDC1.wav" preload="auto" type="audio/wav"></audio>
|
||||
<audio id = "btb_1" src = "snd/btb_1.ogg" preload = "auto" type = "audio/ogg"></audio>
|
||||
<audio id = "btb_2" src = "snd/btb_2.ogg" preload = "auto" type = "audio/ogg"></audio>
|
||||
<audio id = "btb_3" src = "snd/btb_3.ogg" preload = "auto" type = "audio/ogg"></audio>
|
||||
<audio id = "btb_break" src = "snd/btb_break.ogg" preload = "auto" type = "audio/ogg"></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>
|
||||
|
||||
<script src="js/game_logic.js" language="Javascript" type="text/javascript"></script>
|
||||
|
||||
@@ -32,6 +32,7 @@ function pauseSettings() {
|
||||
document.onkeydown = null;
|
||||
|
||||
settings.show();
|
||||
playSound(menuhover)
|
||||
}
|
||||
|
||||
function newGame(event) {
|
||||
@@ -82,6 +83,8 @@ function resume(event) {
|
||||
|
||||
if (matrix.piece) scheduler.setInterval(fall, stats.fallPeriod);
|
||||
else generate();
|
||||
|
||||
playSound(menuconfirm)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,19 +106,19 @@ function generate(piece) {
|
||||
}
|
||||
|
||||
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 () {
|
||||
scheduler.clearTimeout(lockDown);
|
||||
playSound(hardDropSound);
|
||||
playSound(harddrop);
|
||||
while (matrix.piece.move(TRANSLATION.DOWN, ROTATION.NONE, true)) stats.score += 2;
|
||||
matrixCard.classList.remove('hard-dropped-table-animation');
|
||||
matrixCard.offsetHeight;
|
||||
@@ -128,6 +131,7 @@ let playerActions = {
|
||||
if (matrix.piece.holdEnabled) {
|
||||
scheduler.clearInterval(fall);
|
||||
scheduler.clearTimeout(lockDown);
|
||||
playSound(hold)
|
||||
|
||||
let piece = matrix.piece;
|
||||
piece.facing = FACING.NORTH;
|
||||
|
||||
+4
-4
@@ -17,7 +17,7 @@ const T_SPIN = {
|
||||
T_SPIN: "PIROUETTE"
|
||||
}
|
||||
|
||||
// score = AWARDED_LINE_CLEARS[tSpin][nbClearedLines]
|
||||
// score = AWARDED_LINE_CLEARS[tSpin][clearedLines]
|
||||
const AWARDED_LINE_CLEARS = {
|
||||
[T_SPIN.NONE]: [0, 1, 3, 5, 8],
|
||||
[T_SPIN.MINI]: [1, 2],
|
||||
@@ -282,18 +282,18 @@ class Matrix extends MinoesTable {
|
||||
}
|
||||
|
||||
clearLines() {
|
||||
let nbClearedLines = 0
|
||||
let clearedLines = 0
|
||||
for (let y=0; y<this.rows; y++) {
|
||||
let row = this.blocks[y]
|
||||
if (row.filter(lockedMino => lockedMino).length == this.columns) {
|
||||
nbClearedLines++
|
||||
clearedLines++
|
||||
this.blocks.splice(y, 1)
|
||||
this.blocks.unshift(Array(matrix.columns))
|
||||
this.table.rows[y].classList.add("cleared-line-animation")
|
||||
}
|
||||
}
|
||||
this.redraw()
|
||||
return nbClearedLines
|
||||
return clearedLines
|
||||
}
|
||||
}
|
||||
Matrix.prototype.init_center = [4, 4]
|
||||
|
||||
+60
-18
@@ -144,8 +144,8 @@ class Stats {
|
||||
levelInput.value = localStorage['startLevel'] || 1;
|
||||
this.score = 0;
|
||||
this.goal = 0;
|
||||
this.combo = 0;
|
||||
this.b2b = 0;
|
||||
this.combo = -1;
|
||||
this.b2b = -1;
|
||||
this.startTime = new Date();
|
||||
this.lockDelay = DELAY.LOCK;
|
||||
this.totalClearedLines = 0;
|
||||
@@ -231,23 +231,23 @@ class Stats {
|
||||
return new Date() - this.startTime;
|
||||
}
|
||||
|
||||
lockDown(tSpin, nbClearedLines) {
|
||||
this.totalClearedLines += nbClearedLines;
|
||||
if (nbClearedLines == 4) this.nbQuatuors++;
|
||||
lockDown(tSpin, clearedLines) {
|
||||
this.totalClearedLines += clearedLines;
|
||||
if (clearedLines == 4) this.nbQuatuors++;
|
||||
if (tSpin == T_SPIN.T_SPIN) this.nbTSpin++;
|
||||
|
||||
// Cleared lines & T-Spin
|
||||
let awardedLineClears = AWARDED_LINE_CLEARS[tSpin][nbClearedLines];
|
||||
let awardedLineClears = AWARDED_LINE_CLEARS[tSpin][clearedLines];
|
||||
let patternScore = 100 * this.level * awardedLineClears;
|
||||
if (tSpin)
|
||||
messagesSpan.addNewChild('div', {
|
||||
className: 'rotate-in-animation',
|
||||
innerHTML: tSpin,
|
||||
});
|
||||
if (nbClearedLines)
|
||||
if (clearedLines)
|
||||
messagesSpan.addNewChild('div', {
|
||||
className: 'zoom-in-animation',
|
||||
innerHTML: CLEARED_LINES_NAMES[nbClearedLines],
|
||||
innerHTML: CLEARED_LINES_NAMES[clearedLines],
|
||||
});
|
||||
if (patternScore) {
|
||||
messagesSpan.addNewChild('div', {
|
||||
@@ -259,10 +259,10 @@ class Stats {
|
||||
}
|
||||
|
||||
// Combo
|
||||
if (nbClearedLines) {
|
||||
if (clearedLines) {
|
||||
this.combo++;
|
||||
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) {
|
||||
messagesSpan.addNewChild('div', {
|
||||
className: 'zoom-in-animation',
|
||||
@@ -279,11 +279,12 @@ class Stats {
|
||||
this.score += comboScore;
|
||||
}
|
||||
} else {
|
||||
if (this.combo >= 1) playSound(combobreak)
|
||||
this.combo = -1;
|
||||
}
|
||||
|
||||
// Back to back sequence
|
||||
if (nbClearedLines == 4 || (tSpin && nbClearedLines)) {
|
||||
if (clearedLines == 4 || (tSpin && clearedLines)) {
|
||||
this.b2b++;
|
||||
if (this.b2b >= 1) {
|
||||
let b2bScore = patternScore / 2;
|
||||
@@ -302,23 +303,64 @@ class Stats {
|
||||
}
|
||||
this.score += b2bScore;
|
||||
}
|
||||
} else if (nbClearedLines && !tSpin) {
|
||||
} else if (clearedLines && !tSpin) {
|
||||
if (this.b2b >= 1) {
|
||||
messagesSpan.addNewChild('div', {
|
||||
className: 'zoom-in-animation',
|
||||
style: 'animation-delay: .4s',
|
||||
innerHTML: `FIN DU BOUT À BOUT`,
|
||||
});
|
||||
playSound(btb_break)
|
||||
}
|
||||
this.b2b = -1;
|
||||
}
|
||||
|
||||
// Sound
|
||||
if (sfxVolumeRange.value) {
|
||||
if (nbClearedLines == 4) playSound(quatuorSound, this.combo);
|
||||
else if (nbClearedLines) playSound(lineClearSound, this.combo);
|
||||
if (tSpin) playSound(tSpinSound, this.combo);
|
||||
}
|
||||
// Sounds
|
||||
if (clearedLines == 4 || (tSpin && clearedLines)) {
|
||||
if (this.b2b >= 1) switch(this.b2b) {
|
||||
case 1: playSound(btb_1); break
|
||||
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;
|
||||
if (this.goal <= 0) this.level++;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user