speak
This commit is contained in:
@@ -145,7 +145,7 @@ let game = {
|
|||||||
scene.music.pause()
|
scene.music.pause()
|
||||||
stats.clock.stop()
|
stats.clock.stop()
|
||||||
messagesSpan.addNewChild("div", { className: "show-level-animation", innerHTML: `<h1>GAME<br/>OVER</h1>` })
|
messagesSpan.addNewChild("div", { className: "show-level-animation", innerHTML: `<h1>GAME<br/>OVER</h1>` })
|
||||||
stats.speak("Game Over")
|
stats.speak("Game Over", 'en-US')
|
||||||
|
|
||||||
menu.pauseButton.hide()
|
menu.pauseButton.hide()
|
||||||
menu.startButton.name("Rejouer")
|
menu.startButton.name("Rejouer")
|
||||||
@@ -168,7 +168,7 @@ document.onfullscreenchange = function() {
|
|||||||
menu.settings.fullscreenButton.name("Quitter le plein écran")
|
menu.settings.fullscreenButton.name("Quitter le plein écran")
|
||||||
} else {
|
} else {
|
||||||
menu.settings.fullscreenButton.name("Plein écran")
|
menu.settings.fullscreenButton.name("Plein écran")
|
||||||
game.pause()
|
if (game.playing) game.pause()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,10 +194,8 @@ let playerActions = {
|
|||||||
softDrop: function () {
|
softDrop: function () {
|
||||||
if (scene.playfield.piece.move(TRANSLATION.DOWN)) {
|
if (scene.playfield.piece.move(TRANSLATION.DOWN)) {
|
||||||
stats.score++
|
stats.score++
|
||||||
scene.moveSound.stop()
|
|
||||||
scene.moveSound.play()
|
scene.moveSound.play()
|
||||||
} else {
|
} else {
|
||||||
scene.floorSound.stop()
|
|
||||||
scene.floorSound.play()
|
scene.floorSound.play()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
+6
-6
@@ -72,7 +72,7 @@ class Stats {
|
|||||||
if (level <= 20) this.fallPeriod = 1000 * Math.pow(0.8 - ((level - 1) * 0.007), level - 1)
|
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)
|
if (level > 15) this.lockDelay = 500 * Math.pow(0.9, level - 15)
|
||||||
messagesSpan.addNewChild("div", { className: "show-level-animation", innerHTML: `<h1>NIVEAU<br/>${this.level}</h1>` })
|
messagesSpan.addNewChild("div", { className: "show-level-animation", innerHTML: `<h1>NIVEAU<br/>${this.level}</h1>` })
|
||||||
this.speak(`Niveau ${level}`, this.settings.sfxVolume);
|
this.speak(`Niveau ${level}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
get level() {
|
get level() {
|
||||||
@@ -182,20 +182,20 @@ class Stats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*if (this.speechSynthesisAvailable && this.settings.sfxVolume) {
|
/*if (this.speechSynthesisAvailable && this.settings.sfxVolume) {
|
||||||
if (tSpin) this.speak(tSpin, this.settings.sfxVolume);
|
if (tSpin) this.speak(tSpin);
|
||||||
if (nbClearedLines > 1) this.speak(CLEARED_LINES_NAMES[nbClearedLines], this.settings.sfxVolume);
|
if (nbClearedLines > 1) this.speak(CLEARED_LINES_NAMES[nbClearedLines]);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
this.goal -= awardedLineClears
|
this.goal -= awardedLineClears
|
||||||
if (this.goal <= 0) return this.level++
|
if (this.goal <= 0) return this.level++
|
||||||
}
|
}
|
||||||
|
|
||||||
speak(text, volume=1) {
|
speak(text, lang='fr-FR', volume=1) {
|
||||||
if (!this.speechSynthesisAvailable) return;
|
if (!this.speechSynthesisAvailable) return;
|
||||||
|
|
||||||
const utterance = new SpeechSynthesisUtterance(text);
|
const utterance = new SpeechSynthesisUtterance(text);
|
||||||
utterance.lang = 'fr-FR';
|
utterance.lang = lang;
|
||||||
utterance.volume = volume;
|
utterance.volume = this.settings.sfxVolume;
|
||||||
speechSynthesis.speak(utterance);
|
speechSynthesis.speak(utterance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -168,7 +168,7 @@ InstancedMino.prototype.materials = {
|
|||||||
envMap: environment,
|
envMap: environment,
|
||||||
side: THREE.DoubleSide,
|
side: THREE.DoubleSide,
|
||||||
transparent: true,
|
transparent: true,
|
||||||
opacity: 0.66,
|
opacity: 0.8,
|
||||||
roughness: 0.1,
|
roughness: 0.1,
|
||||||
metalness: 0.6,
|
metalness: 0.6,
|
||||||
onBeforeCompile: shader => {
|
onBeforeCompile: shader => {
|
||||||
|
|||||||
+1
-1
@@ -79,7 +79,7 @@ export class Vortex extends THREE.Group {
|
|||||||
loader.load("./images/stars_space.jpg", texture => {
|
loader.load("./images/stars_space.jpg", texture => {
|
||||||
texture.wrapS = THREE.MirroredRepeatWrapping
|
texture.wrapS = THREE.MirroredRepeatWrapping
|
||||||
texture.wrapT = 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 = texture
|
||||||
this.opaqueCylinder.material.map.offset.x = 5
|
this.opaqueCylinder.material.map.offset.x = 5
|
||||||
this.opaqueCylinder.material.blending = THREE.AdditiveBlending
|
this.opaqueCylinder.material.blending = THREE.AdditiveBlending
|
||||||
|
|||||||
Reference in New Issue
Block a user