Skip to content

Commit

Permalink
Some serverside base work + added some silence at end of drum loop wa…
Browse files Browse the repository at this point in the history
…v so that ToneJS stops whining
  • Loading branch information
nectarboy committed Dec 14, 2024
1 parent 5b2e7ed commit a3d66b3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
1 change: 0 additions & 1 deletion assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class Assets {
const AudioContext = window.AudioContext || window.webkitAudioContext;
var audioCtx = new AudioContext();
var audioFile = fetch(src).then(response => response.arrayBuffer()).then(buffer => audioCtx.decodeAudioData(buffer)).then(buffer => {
console.log(buffer);
assetsobj[id] = buffer;
onLoad();
});
Expand Down
24 changes: 21 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ <h3>wanted minigame 1 week challenge</h3>
sfx_timeup: 'yoshi_timeup',
};

var sessionid = '';

var holdingclick = false;

var state = 0;
Expand Down Expand Up @@ -381,7 +383,7 @@ <h3>wanted minigame 1 week challenge</h3>
wantedbro = E_LUIGI; // "On level 10, Luigi is always the character having to be found."
else
wantedbro = getRandomBroType();
console.log('next wanted bro:', wantedbro);
//console.log('next wanted bro:', wantedbro);
}

var bros = [];
Expand Down Expand Up @@ -536,7 +538,7 @@ <h3>wanted minigame 1 week challenge</h3>
return;

if (bros[wantedbroi].mouseIsInside(x,y - SH)) {
console.log('yes :)');
//console.log('yes :)');

correctEvent();
particles.push(new Particle(bros[wantedbroi].x, bros[wantedbroi].y, PARTICLE_P5));
Expand All @@ -551,7 +553,7 @@ <h3>wanted minigame 1 week challenge</h3>
continue;

if (sorted[i].mouseIsInside(x,y - SH) && !sorted[i].invincibility) {
console.log('no :(');
//console.log('no :(');
sorted[i].invincibility = INVINCIBILITY_DURATION;
time -= 10;
if (time <= 0) {
Expand Down Expand Up @@ -826,6 +828,11 @@ <h3>wanted minigame 1 week challenge</h3>

if ((level % 5) !== 0)
tick = DRUM_ROLL_DURATION - 30;

if (sessionid) {
fetch(`http://localhost:9000/advancesessionlevel?uuid=${sessionid}&level=${level}`);
console.log('Requesting to advance session level');
}
}

drawBg();
Expand All @@ -843,6 +850,17 @@ <h3>wanted minigame 1 week challenge</h3>
}

function start() {
// Session
if (sessionid) {
fetch(`http://localhost:9000/endsession?uuid=${sessionid}`);
console.log('Requesting to close session');
sessionid = '';
}
fetch('http://localhost:9000/startsession').then(response => response.json()).then(json => {
sessionid = json;
console.log('Got session id', sessionid);
});

Tone.start();
sfx['bgm'].stopAllPlaying();
sfx['bgm'].play();
Expand Down
4 changes: 2 additions & 2 deletions loop.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class Loop {
if (!browservisibilitypaused) {
loop.start();
}
console.log('unhidden tab', browservisibilitypaused, this.paused); // THIS IS SO ANNOYING WHY DID I KEEP THIS SO LONG
//console.log('unhidden tab', browservisibilitypaused, this.paused); // THIS IS SO ANNOYING WHY DID I KEEP THIS SO LONG
}
else {
if (this.hidden)
Expand All @@ -119,7 +119,7 @@ class Loop {

browservisibilitypaused = this.paused;
loop.stop();
console.log('hidden tab', browservisibilitypaused, this.paused);
//console.log('hidden tab', browservisibilitypaused, this.paused);
}
});

Expand Down
Binary file modified src/sfx/drumroll_loop.wav
Binary file not shown.

0 comments on commit a3d66b3

Please sign in to comment.