combo sound
This commit is contained in:
parent
c9b242c9c2
commit
3345a50803
16
app.js
16
app.js
@ -88,16 +88,14 @@ let game = {
|
|||||||
if (playfield.lock(playfield.piece)) {
|
if (playfield.lock(playfield.piece)) {
|
||||||
let tSpin = playfield.piece.tSpin
|
let tSpin = playfield.piece.tSpin
|
||||||
let nbClearedLines = playfield.clearLines()
|
let nbClearedLines = playfield.clearLines()
|
||||||
|
stats.lockDown(nbClearedLines, tSpin)
|
||||||
if (settings.sfxVolume) {
|
if (settings.sfxVolume) {
|
||||||
if (nbClearedLines == 4 || (tSpin && nbClearedLines)) {
|
if (nbClearedLines == 4 || (tSpin && nbClearedLines)) {
|
||||||
scene.tetrisSound.stop()
|
playSound(scene.tetrisSound, stats.combo)
|
||||||
scene.tetrisSound.play()
|
|
||||||
} else if (nbClearedLines || tSpin) {
|
} else if (nbClearedLines || tSpin) {
|
||||||
scene.lineClearSound.stop()
|
playSound(scene.lineClearSound, stats.combo)
|
||||||
scene.lineClearSound.play()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stats.lockDown(nbClearedLines, tSpin)
|
|
||||||
|
|
||||||
game.generate()
|
game.generate()
|
||||||
} else {
|
} else {
|
||||||
@ -146,6 +144,14 @@ let game = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function playSound(sound, note=0) {
|
||||||
|
sound.stop()
|
||||||
|
sound.currentTime = 0
|
||||||
|
sound.playbackRate = Math.pow(5/4, note)
|
||||||
|
sound.play()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Handle player inputs */
|
/* Handle player inputs */
|
||||||
|
|
||||||
let playerActions = {
|
let playerActions = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user