diff --git a/README.md b/README.md index f1b53b8..aaf92dd 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,6 @@ Browser game built using HTML, CSS and JS create switch statement for different objects (depending on input integer) -3. Add ideas class (with sound) - 4. Configure mechanics so that collision increases feedback ++) Add background soundscape @@ -28,9 +26,11 @@ create switch statement for different objects (depending on input integer) ++ random speed of objects (1-10); +++ change object path (via. touchdesigner) + 5. Add more objects -6. Change direction of avatar on click +6. Change choice of avatar (on load) ++) refine sound track/sound components @@ -40,7 +40,10 @@ increase density of objects depending on screen size 8. Add sound fx over time - reverb, delay etc. +scale objects and player for smaller browser + ++ add font scaling function // seperate canvas for score +?? change path of objects (sometimes arising from horizontal direction)? // rules @@ -48,4 +51,4 @@ density > over time feedback ++ when you hit objects -++ create imports/exports for functions and write a test for some of them +// write some function tests diff --git a/main.js b/main.js index 5d126f2..33b032e 100644 --- a/main.js +++ b/main.js @@ -5,8 +5,8 @@ let score = 0; let gameFrame = 0; -let densityModulo = 50; -let feedbackModulo = 1; +let densityModulo = 1; +let feedbackModulo = 5000; // GLOBAL FUNCTIONS @@ -203,7 +203,7 @@ const objectArray = []; let shuffledArray = shuffleArr(objectLoader); -function handleObjects() { +const handleObjects = () => { if (gameFrame % densityModulo == 0) { //every 50 frames.. @@ -396,12 +396,12 @@ function handleObjects() { } for (let i = 0; i < objectArray.length; i++) { - // call update and draw methods for each bubbles in the array + // call update and draw methods for each object in the array objectArray[i].update(); objectArray[i].draw(); } - // when y position > 0 then delete bubbles. 0 - this.radius * 2 ensures full bubbles has passed + // when y position > 0 then delete object. 0 - this.radius * 2 ensures full bubbles has passed for (let i = 0; i < objectArray.length; i++) { if (objectArray[i].y < 0 - objectArray[i].radius * 2) { @@ -412,7 +412,7 @@ function handleObjects() { if (objectArray[i].distance < objectArray[i].radius + player.radius) { // this line allows us to set the score only once per bubble, even though multiple collisions will continue to be registered if (!objectArray[i].counted) { - if (objectArray[i].sound == "milk") { + if (objectArray[i].sound == "yakyu") { soundArray[0].play(); } else if (objectArray[i].sound == "folder") { soundArray[1].play(); @@ -424,6 +424,24 @@ function handleObjects() { soundArray[4].play(); } else if (objectArray[i].sound == "humberg") { soundArray[5].play(); + } else if (objectArray[i].sound == "kamakiri") { + soundArray[6].play(); + } else if (objectArray[i].sound == "master") { + soundArray[7].play(); + } else if (objectArray[i].sound == "milk") { + soundArray[8].play(); + } else if (objectArray[i].sound == "pencil") { + soundArray[9].play(); + } else if (objectArray[i].sound == "ramensoup") { + soundArray[10].play(); + } else if (objectArray[i].sound == "shows") { + soundArray[11].play(); + } else if (objectArray[i].sound == "tomato") { + soundArray[12].play(); + } else if (objectArray[i].sound == "tyun") { + soundArray[13].play(); + } else if (objectArray[i].sound == "usagi") { + soundArray[14].play(); } score++; objectArray[i].counted = true; @@ -433,7 +451,7 @@ function handleObjects() { } // collision detection, using distance of each bubble agaisnt player radius } -} +}; // ANIMATION LOOP diff --git a/sounds/0.mp3 b/sounds/0.mp3 index f3128c3..f759a2c 100644 Binary files a/sounds/0.mp3 and b/sounds/0.mp3 differ diff --git a/sounds/1.mp3 b/sounds/1.mp3 index 13ca221..5f1bf0f 100644 Binary files a/sounds/1.mp3 and b/sounds/1.mp3 differ diff --git a/sounds/10.mp3 b/sounds/10.mp3 index 5ee6858..7396f7d 100644 Binary files a/sounds/10.mp3 and b/sounds/10.mp3 differ diff --git a/sounds/11.mp3 b/sounds/11.mp3 index d06c191..246b2b3 100644 Binary files a/sounds/11.mp3 and b/sounds/11.mp3 differ diff --git a/sounds/12.mp3 b/sounds/12.mp3 index 8cc6a86..782d8dd 100644 Binary files a/sounds/12.mp3 and b/sounds/12.mp3 differ diff --git a/sounds/13.mp3 b/sounds/13.mp3 index 5063305..ffa83e2 100644 Binary files a/sounds/13.mp3 and b/sounds/13.mp3 differ diff --git a/sounds/14.mp3 b/sounds/14.mp3 index 0676fc1..0a3d43d 100644 Binary files a/sounds/14.mp3 and b/sounds/14.mp3 differ diff --git a/sounds/2.mp3 b/sounds/2.mp3 index 453fa20..d886c6f 100644 Binary files a/sounds/2.mp3 and b/sounds/2.mp3 differ diff --git a/sounds/3.mp3 b/sounds/3.mp3 index 2891290..7077b26 100644 Binary files a/sounds/3.mp3 and b/sounds/3.mp3 differ diff --git a/sounds/4.mp3 b/sounds/4.mp3 index 882afe7..b943c53 100644 Binary files a/sounds/4.mp3 and b/sounds/4.mp3 differ diff --git a/sounds/5.mp3 b/sounds/5.mp3 index 85d4557..5f522b0 100644 Binary files a/sounds/5.mp3 and b/sounds/5.mp3 differ diff --git a/sounds/6.mp3 b/sounds/6.mp3 index bbae56b..bb3ecb4 100644 Binary files a/sounds/6.mp3 and b/sounds/6.mp3 differ diff --git a/sounds/7.mp3 b/sounds/7.mp3 index fafa49c..909b8a5 100644 Binary files a/sounds/7.mp3 and b/sounds/7.mp3 differ diff --git a/sounds/8.mp3 b/sounds/8.mp3 index 0d46358..0fb7377 100644 Binary files a/sounds/8.mp3 and b/sounds/8.mp3 differ diff --git a/sounds/9.mp3 b/sounds/9.mp3 index af4e6d7..8f64c79 100644 Binary files a/sounds/9.mp3 and b/sounds/9.mp3 differ