Skip to content

Commit

Permalink
create audio.js and set variables, functions, export
Browse files Browse the repository at this point in the history
  • Loading branch information
rbozek committed Jan 4, 2024
1 parent 4be8efe commit 228155d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions js/audio.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
let click = new Audio('../assets/audio/click.wav')
let ding = new Audio('../assets/audio/ding.wav')
let sadTrombone = new Audio('../assets/audio/sadtrombone.wav')
let levelSuccess = new Audio('../assets/audio/levelsuccesstrimmed.mp3')
let levelFail = new Audio('../assets/audio/levelfailtrimmed.mp3')

function playClick() {
click.volume = 0.15
click.play()
}
function playDing() {
ding.volume = 0.15
ding.play()
}
function playTrombone() {
sadTrombone.volume = 0.15
sadTrombone.play()
}
function playLevelSucceed() {
levelSuccess.volume = 0.15
levelSuccess.play()
}
function playLevelFail() {
levelFail.volume = 0.15
levelFail.play()
}

export {
playClick,
playDing,
playTrombone,
playLevelSucceed,
playLevelFail
}

0 comments on commit 228155d

Please sign in to comment.