speak
This commit is contained in:
12
js/app.js
12
js/app.js
@@ -276,6 +276,16 @@ function gameOver() {
|
|||||||
|
|
||||||
stats.show();
|
stats.show();
|
||||||
playSound(gameover)
|
playSound(gameover)
|
||||||
|
speak("Game over")
|
||||||
|
}
|
||||||
|
|
||||||
|
function speak(text) {
|
||||||
|
if (!window.speechSynthesis) return;
|
||||||
|
|
||||||
|
const utterance = new SpeechSynthesisUtterance(text);
|
||||||
|
utterance.lang = 'fr-FR';
|
||||||
|
utterance.volume = sfxVolumeRange.value;
|
||||||
|
speechSynthesis.speak(utterance);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onbeforeunload = function (event) {
|
window.onbeforeunload = function (event) {
|
||||||
@@ -344,6 +354,8 @@ sceneDiv.onwheel = function (event) {
|
|||||||
screenRow.style.setProperty('--tZ', tZ + 'px');
|
screenRow.style.setProperty('--tZ', tZ + 'px');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Skins
|
||||||
|
|
||||||
$.fn.select2.defaults.set("templateResult", (state) =>
|
$.fn.select2.defaults.set("templateResult", (state) =>
|
||||||
state.id
|
state.id
|
||||||
? $(`<img class="preview" src="${state.id}" title="${state.text}" loading="lazy"/>`)
|
? $(`<img class="preview" src="${state.id}" title="${state.text}" loading="lazy"/>`)
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ class Stats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set level(level) {
|
set level(level) {
|
||||||
|
speak(`Niveau ${level}`)
|
||||||
this._level = level;
|
this._level = level;
|
||||||
this.goal += level * 5;
|
this.goal += level * 5;
|
||||||
if (level <= 20) {
|
if (level <= 20) {
|
||||||
|
|||||||
Reference in New Issue
Block a user