diff --git a/app.js b/app.js
index e9373ef..9005116 100644
--- a/app.js
+++ b/app.js
@@ -138,6 +138,7 @@ let game = {
scene.music.pause()
stats.clock.stop()
messagesSpan.addNewChild("div", { className: "show-level-animation", innerHTML: `
GAME
OVER
` })
+ stats.speak("Game Over")
menu.pauseButton.hide()
menu.startButton.name("Rejouer")
diff --git a/jsm/Stats.js b/jsm/Stats.js
index 8bc3a66..f43b91c 100644
--- a/jsm/Stats.js
+++ b/jsm/Stats.js
@@ -34,6 +34,7 @@ class Stats {
timeZone: "UTC"
})
this.elapsedTime = 0
+ this.speechSynthesisAvailable = 'speechSynthesis' in window;
this.init()
}
@@ -71,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}
` })
- speak(`Niveau ${level}`, this.settings.sfxVolume);
+ this.speak(`Niveau ${level}`, this.settings.sfxVolume);
}
get level() {
@@ -180,24 +181,23 @@ class Stats {
this.b2b = -1
}
- if (speechSynthesisAvailable && this.settings.sfxVolume) {
- if (tSpin) speak(tSpin, this.settings.sfxVolume);
- if (nbClearedLines) speak(CLEARED_LINES_NAMES[nbClearedLines], this.settings.sfxVolume);
+ if (this.speechSynthesisAvailable && this.settings.sfxVolume) {
+ if (tSpin) this.speak(tSpin, this.settings.sfxVolume);
+ if (nbClearedLines) this.speak(CLEARED_LINES_NAMES[nbClearedLines], this.settings.sfxVolume);
}
this.goal -= awardedLineClears
if (this.goal <= 0) return this.level++
}
-}
+ speak(text, volume=1) {
+ if (!this.speechSynthesisAvailable) return;
-const speechSynthesisAvailable = 'speechSynthesis' in window;
-function speak(text, volume=1) {
- if (!speechSynthesisAvailable) return;
- const utterance = new SpeechSynthesisUtterance(text);
- utterance.lang = 'fr-FR';
- utterance.volume = volume;
- speechSynthesis.speak(utterance);
+ const utterance = new SpeechSynthesisUtterance(text);
+ utterance.lang = 'fr-FR';
+ utterance.volume = volume;
+ speechSynthesis.speak(utterance);
+ }
}
diff --git a/jsm/Tetrominoes.js b/jsm/Tetrominoes.js
index f85fc79..d79bf39 100644
--- a/jsm/Tetrominoes.js
+++ b/jsm/Tetrominoes.js
@@ -164,8 +164,8 @@ InstancedMino.prototype.materials = {
envMap: environment,
side: THREE.DoubleSide,
transparent: true,
- opacity: 0.5,
- roughness: 0.25,
+ opacity: 0.55,
+ roughness: 0.35,
metalness: 0.9,
}),
Espace: new THREE.MeshStandardMaterial({