Browse Source

add more sounds and things

main
James Fenn 1 month ago
parent
commit
55c6d65e2b
4 changed files with 37 additions and 3 deletions
  1. BIN
      fan.mp3
  2. BIN
      flush.mp3
  3. +37
    -3
      sketch.js
  4. BIN
      slurp.mp3

BIN
fan.mp3 View File


BIN
flush.mp3 View File


+ 37
- 3
sketch.js View File

@@ -1,6 +1,9 @@
const _images = {};
const _sounds = {
beep: new Audio("./beep.mp3"),
slurp: new Audio('./slurp.mp3'),
flush: new Audio('./flush.mp3'),
fan: new Audio('./fan.mp3'),
music: new Audio("./Punch Deck - Snowfall.wav")
};

@@ -19,6 +22,8 @@ let _message = {
let _smokeLevel = 0;
let _smokeParticles = [];

let _slurpLevel = 0;

let _mouseIsClicked = false;
let _mouseWasClicked = false;

@@ -134,7 +139,7 @@ function draw_desk() {
// twitch box
create_arrow(...percent(3, 45, 30, 30), {
message: "I stream on twitch! Sometimes.",
click: () => location.href = "https://twitch.tv/fennifith"
click: () => window.open("https://twitch.tv/fennifith", "_blank")
});

// headphones box
@@ -165,7 +170,7 @@ function draw_desk() {
} else {
_scene = 'error';
_message = {
text: "Look what you did! The GPU had too much smoke to render and it crashed! Now I gotta restart my laptop again...",
text: "Look what you did! The GPU had too many smoke effects to render and it crashed! Now I gotta restart my laptop again...",
visible: true
};
}
@@ -189,7 +194,7 @@ function draw_desk() {
});

// second monitor (programming) box
create_arrow(...percent(50, 38, 48, 42), {
create_arrow(...percent(50, 38, 48, 37), {
message: "Open Source Software",
click: () => {
_message = {
@@ -198,6 +203,26 @@ function draw_desk() {
};
}
});

// click on the water for slurp sounds, I guess...
create_arrow(...percent(90, 75, 10, 25), {
click: () => {
if (!_sounds.slurp.paused || !_sounds.flush.paused)
return;

if (_slurpLevel < 2) {
_slurpLevel++;
_sounds.slurp.volume = 0.4;
_sounds.slurp.currentTime = 0;
_sounds.slurp.play();
} else {
_slurpLevel = 0;
_sounds.flush.volume = 0.4;
_sounds.flush.currentTime = 0;
_sounds.flush.play();
}
}
});
}

function draw_error() {
@@ -289,6 +314,15 @@ function create_smoke(x, y) {
r, r
);
});

if (_smokeLevel > 0) {
if (_sounds.fan.paused) {
_sounds.fan.volume = 0.1;
_sounds.fan.play();
} else if (_sounds.fan.currentTime > 19) {
_sounds.fan.currentTime = 6;
}
}
}

function windowResized() {


BIN
slurp.mp3 View File


Loading…
Cancel
Save