Browse Source

more sound effects

main
James Fenn 3 weeks ago
parent
commit
5a493755ef
4 changed files with 14 additions and 2 deletions
  1. +1
    -1
      README.md
  2. BIN
      achievement.mp3
  3. BIN
      corrupt.mp3
  4. +13
    -1
      sketch.js

+ 1
- 1
README.md View File

@@ -6,7 +6,7 @@ Worth noting, I designed this to be viewed on a laptop/desktop, not a mobile or

## Design

I wrote this website using [p5js](https://p5js.org), a JavaScript graphics library that allows developers to easily create small interactive programs like this one. It also uses some music by [Punch Deck](https://punchdeck.bandcamp.com), under the [Creative Commons Attribution 3.0 Unported](https://creativecommons.org/licenses/by/3.0/) license.
I wrote this website using [p5js](https://p5js.org), a JavaScript graphics library that allows developers to easily create small interactive programs like this one. It also uses some music by [Punch Deck](https://punchdeck.bandcamp.com), under the [Creative Commons Attribution 3.0 Unported](https://creativecommons.org/licenses/by/3.0/) license - and some sound effects from [freesound.org](https://freesound.org).

As this is an introduction piece, I started by thinking about my identity and the information I wanted to include. I write software, I play games, I do weird things with technology and enjoy finding little bugs and "features" in their many forms. A good way to connect all this together - and very topical, as it is what I see the most of these days - is the view of my desk.



BIN
achievement.mp3 View File


BIN
corrupt.mp3 View File


+ 13
- 1
sketch.js View File

@@ -4,6 +4,8 @@ const _sounds = {
slurp: new Audio('./slurp.mp3'),
flush: new Audio('./flush.mp3'),
fan: new Audio('./fan.mp3'),
corrupt: new Audio('./corrupt.mp3'),
achievement: new Audio('./achievement.mp3'),
music: new Audio("./Punch Deck - Snowfall.wav")
};

@@ -16,7 +18,7 @@ const _clipList = {
'RefinedWealthyGuanacoOhMyDog': 42
};

let _clipIndex = 0;
let _clipIndex = Math.floor(Math.random() * Object.keys(_clipList).length);

const _achievements = {};

@@ -134,6 +136,11 @@ function draw() {
if (_toast) {
if (typeof _toast.startAt === 'undefined') {
_toast.startAt = frameCount;

_sounds.achievement.pause();
_sounds.achievement.currentTime = 0;
_sounds.achievement.volume = 0.3;
_sounds.achievement.play();
}

let xDiff = 0;
@@ -259,6 +266,11 @@ function draw_desk() {
title: "You broke it!",
text: "Render too much smoke & break the game."
};

_sounds.corrupt.pause();
_sounds.corrupt.currentTime = 0;
_sounds.corrupt.volume = 0.3;
_sounds.corrupt.play();
}
}
});


Loading…
Cancel
Save