Sound & favicon
This commit is contained in:
parent
b9ff06f32d
commit
d5eb58334c
35
app.js
35
app.js
@ -350,7 +350,6 @@ class Tetromino extends THREE.Group {
|
|||||||
let testFacing = (this.facing + rotation + 4) % 4
|
let testFacing = (this.facing + rotation + 4) % 4
|
||||||
return this.srs[this.facing][rotation].some((translation, rotationPoint) => {
|
return this.srs[this.facing][rotation].some((translation, rotationPoint) => {
|
||||||
if (this.move(translation, testFacing)) {
|
if (this.move(translation, testFacing)) {
|
||||||
//rotateSound.play()
|
|
||||||
this.facing = testFacing
|
this.facing = testFacing
|
||||||
this.rotatedLast = true
|
this.rotatedLast = true
|
||||||
if (rotationPoint == 4) this.rotationPoint4Used = true
|
if (rotationPoint == 4) this.rotationPoint4Used = true
|
||||||
@ -898,10 +897,12 @@ nextQueue.position.set(4, SKYLINE + 3)
|
|||||||
scene.add(nextQueue)
|
scene.add(nextQueue)
|
||||||
let ghost = new Ghost()
|
let ghost = new Ghost()
|
||||||
|
|
||||||
const lineClearSound = new Audio("audio/line_clear.ogg")
|
const lineClearSound = new Audio("audio/line-clear.wav")
|
||||||
const tetrisSound = new Audio("audio/tetris.ogg")
|
const tetrisSound = new Audio("audio/tetris.wav")
|
||||||
const music = new Audio("https://iterations.org/files/music/remixes/Tetris_CheDDer_OC_ReMix.mp3")
|
const hardDropSound = new Audio("audio/hard-drop.wav")
|
||||||
music.loop = true
|
const tSpinSound = new Audio("audio/t-spin.wav")
|
||||||
|
const music = new Audio("https://iterations.org/files/music/remixes/Tetris_CheDDer_OC_ReMix.mp3")
|
||||||
|
music.loop = true
|
||||||
|
|
||||||
window.addEventListener("resize", () => {
|
window.addEventListener("resize", () => {
|
||||||
renderer.setSize(window.innerWidth, window.innerHeight)
|
renderer.setSize(window.innerWidth, window.innerHeight)
|
||||||
@ -1015,7 +1016,9 @@ function resume(event) {
|
|||||||
stats.time = stats.pauseTime
|
stats.time = stats.pauseTime
|
||||||
|
|
||||||
lineClearSound.volume = settings.sfxVolume
|
lineClearSound.volume = settings.sfxVolume
|
||||||
tetrisSound.volume = settings.sfxVolume
|
tetrisSound.volume = settings.sfxVolume
|
||||||
|
hardDropSound.volume = settings.sfxVolume
|
||||||
|
tSpinSound.volume = settings.sfxVolume
|
||||||
if (settings.musicVolume > 0) {
|
if (settings.musicVolume > 0) {
|
||||||
music.volume = settings.musicVolume
|
music.volume = settings.musicVolume
|
||||||
music.play()
|
music.play()
|
||||||
@ -1060,7 +1063,11 @@ let playerActions = {
|
|||||||
|
|
||||||
hardDrop: function () {
|
hardDrop: function () {
|
||||||
scheduler.clearTimeout(lockDown)
|
scheduler.clearTimeout(lockDown)
|
||||||
//hardDropSound.play()
|
hardDropSound.play()
|
||||||
|
if (settings.sfxVolume) {
|
||||||
|
hardDropSound.currentTime = 0
|
||||||
|
hardDropSound.play()
|
||||||
|
}
|
||||||
while (piece.move(TRANSLATION.DOWN)) stats.score += 2
|
while (piece.move(TRANSLATION.DOWN)) stats.score += 2
|
||||||
lockDown()
|
lockDown()
|
||||||
},
|
},
|
||||||
@ -1153,12 +1160,14 @@ function lockDown() {
|
|||||||
scene.remove(piece)
|
scene.remove(piece)
|
||||||
let tSpin = piece.tSpin
|
let tSpin = piece.tSpin
|
||||||
let nbClearedLines = matrix.clearLines()
|
let nbClearedLines = matrix.clearLines()
|
||||||
if (nbClearedLines == 4 || (nbClearedLines && tSpin)) {
|
if (settings.sfxVolume) {
|
||||||
tetrisSound.currentTime = 0
|
if (nbClearedLines == 4 || (tSpin && nbClearedLines)) {
|
||||||
if (tetrisSound.volume) tetrisSound.play()
|
tetrisSound.currentTime = 0
|
||||||
} else if (nbClearedLines || tSpin) {
|
tetrisSound.play()
|
||||||
lineClearSound.currentTime = 0
|
} else if (nbClearedLines || tSpin) {
|
||||||
if (lineClearSound.volume) lineClearSound.play()
|
lineClearSound.currentTime = 0
|
||||||
|
lineClearSound.play()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
stats.lockDown(nbClearedLines, tSpin)
|
stats.lockDown(nbClearedLines, tSpin)
|
||||||
|
|
||||||
|
BIN
audio/hard-drop.wav
Normal file
BIN
audio/hard-drop.wav
Normal file
Binary file not shown.
BIN
audio/line-clear.wav
Normal file
BIN
audio/line-clear.wav
Normal file
Binary file not shown.
Binary file not shown.
BIN
audio/tetris.ogg
BIN
audio/tetris.ogg
Binary file not shown.
BIN
audio/tetris.wav
Normal file
BIN
audio/tetris.wav
Normal file
Binary file not shown.
BIN
audio/tetris.xt
BIN
audio/tetris.xt
Binary file not shown.
BIN
favicon.ico
BIN
favicon.ico
Binary file not shown.
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 118 KiB |
Loading…
x
Reference in New Issue
Block a user