fix sound selector

+ favicon
+ temporary debug log for sound in RectangleClient
This commit is contained in:
LuckyLaszlo
2022-12-17 20:33:58 +01:00
parent 42f2d76f30
commit 04029c9988
39 changed files with 14 additions and 7 deletions

View File

@@ -15,7 +15,7 @@
let optionsAreNotSet = true
let soundMutedFlag = false;
let sound = "on"; // possible de faire un boolean avec svelte et radio buttons ?
let multi_balls = false;
let moving_walls = false;
let matchOptions : enumeration.MatchOptions = enumeration.MatchOptions.noOption;
@@ -23,9 +23,14 @@
// En async au cas où pour la suite mais apriori inutile, les check se feront sûrement au onMount
const init = async() => {
console.log(soundMutedFlag);
if (sound === "off") {
initAudio(true);
}
else if (sound === "on") {
initAudio(false);
}
console.log(sound);
initAudio(soundMutedFlag);
if (multi_balls === true) {
matchOptions |= enumeration.MatchOptions.multiBalls;
}
@@ -86,9 +91,9 @@
<div>
<!-- svelte-ignore a11y-label-has-associated-control -->
<label>sound :</label>
<input type="radio" id="sound_on" name="sound_selector" bind:group={soundMutedFlag} value=false checked>
<input type="radio" id="sound_on" name="sound_selector" bind:group={sound} value="on">
<label for="sound_on">on</label>
<input type="radio" id="sound_off" name="sound_selector" bind:group={soundMutedFlag} value=true>
<input type="radio" id="sound_off" name="sound_selector" bind:group={sound} value="off">
<label for="sound_off">off</label>
</div>
<div>

View File

@@ -81,7 +81,9 @@ export class BallClient extends Ball implements GraphicComponent {
}
bounce(collider?: Rectangle) {
this._bounceAlgo(collider);
soundPongArr[ Math.floor(random(0, soundPongArr.length)) ].play();
let i = Math.floor(random(0, soundPongArr.length));
soundPongArr[ i ].play();
console.log(`sound_i=${i}`); // debug log
}
}