From 891b8d421b42f05e7470656332bd5896f3fa1f66 Mon Sep 17 00:00:00 2001 From: adrien Date: Sat, 8 Aug 2026 01:24:26 +0200 Subject: [PATCH] speak --- app.js | 6 ++---- jsm/Stats.js | 12 ++++++------ jsm/Tetrominoes.js | 2 +- jsm/Vortex.js | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/app.js b/app.js index 35c3603..d8667e3 100644 --- a/app.js +++ b/app.js @@ -145,7 +145,7 @@ let game = { scene.music.pause() stats.clock.stop() messagesSpan.addNewChild("div", { className: "show-level-animation", innerHTML: `

GAME
OVER

` }) - stats.speak("Game Over") + stats.speak("Game Over", 'en-US') menu.pauseButton.hide() menu.startButton.name("Rejouer") @@ -168,7 +168,7 @@ document.onfullscreenchange = function() { menu.settings.fullscreenButton.name("Quitter le plein écran") } else { menu.settings.fullscreenButton.name("Plein écran") - game.pause() + if (game.playing) game.pause() } } @@ -194,10 +194,8 @@ let playerActions = { softDrop: function () { if (scene.playfield.piece.move(TRANSLATION.DOWN)) { stats.score++ - scene.moveSound.stop() scene.moveSound.play() } else { - scene.floorSound.stop() scene.floorSound.play() } }, diff --git a/jsm/Stats.js b/jsm/Stats.js index 00734fb..ea6ca1b 100644 --- a/jsm/Stats.js +++ b/jsm/Stats.js @@ -72,7 +72,7 @@ class Stats { if (level <= 20) this.fallPeriod = 1000 * Math.pow(0.8 - ((level - 1) * 0.007), level - 1) if (level > 15) this.lockDelay = 500 * Math.pow(0.9, level - 15) messagesSpan.addNewChild("div", { className: "show-level-animation", innerHTML: `

NIVEAU
${this.level}

` }) - this.speak(`Niveau ${level}`, this.settings.sfxVolume); + this.speak(`Niveau ${level}`); } get level() { @@ -182,20 +182,20 @@ class Stats { } /*if (this.speechSynthesisAvailable && this.settings.sfxVolume) { - if (tSpin) this.speak(tSpin, this.settings.sfxVolume); - if (nbClearedLines > 1) this.speak(CLEARED_LINES_NAMES[nbClearedLines], this.settings.sfxVolume); + if (tSpin) this.speak(tSpin); + if (nbClearedLines > 1) this.speak(CLEARED_LINES_NAMES[nbClearedLines]); }*/ this.goal -= awardedLineClears if (this.goal <= 0) return this.level++ } - speak(text, volume=1) { + speak(text, lang='fr-FR', volume=1) { if (!this.speechSynthesisAvailable) return; const utterance = new SpeechSynthesisUtterance(text); - utterance.lang = 'fr-FR'; - utterance.volume = volume; + utterance.lang = lang; + utterance.volume = this.settings.sfxVolume; speechSynthesis.speak(utterance); } } diff --git a/jsm/Tetrominoes.js b/jsm/Tetrominoes.js index 64caee9..0156ba7 100644 --- a/jsm/Tetrominoes.js +++ b/jsm/Tetrominoes.js @@ -168,7 +168,7 @@ InstancedMino.prototype.materials = { envMap: environment, side: THREE.DoubleSide, transparent: true, - opacity: 0.66, + opacity: 0.8, roughness: 0.1, metalness: 0.6, onBeforeCompile: shader => { diff --git a/jsm/Vortex.js b/jsm/Vortex.js index cbff238..03423cf 100644 --- a/jsm/Vortex.js +++ b/jsm/Vortex.js @@ -79,7 +79,7 @@ export class Vortex extends THREE.Group { loader.load("./images/stars_space.jpg", texture => { texture.wrapS = THREE.MirroredRepeatWrapping texture.wrapT = THREE.MirroredRepeatWrapping - texture.repeat.set(3, 6) + texture.repeat.set(4, 6) this.opaqueCylinder.material.map = texture this.opaqueCylinder.material.map.offset.x = 5 this.opaqueCylinder.material.blending = THREE.AdditiveBlending