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

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -6,7 +6,7 @@
<title>Potato Pong</title> <title>Potato Pong</title>
<link rel='icon' type='image/png' href='/favicon.png'> <link rel='icon' type='image/x-icon' href='/favicon.ico'>
<link rel='stylesheet' href='/global.css'> <link rel='stylesheet' href='/global.css'>
<link rel='stylesheet' href='/build/bundle.css'> <link rel='stylesheet' href='/build/bundle.css'>

View File

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

View File

@@ -81,7 +81,9 @@ export class BallClient extends Ball implements GraphicComponent {
} }
bounce(collider?: Rectangle) { bounce(collider?: Rectangle) {
this._bounceAlgo(collider); 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
} }
} }