diff options
author | Minteck <nekostarfan@gmail.com> | 2021-06-05 19:27:48 +0200 |
---|---|---|
committer | Minteck <nekostarfan@gmail.com> | 2021-06-05 19:27:48 +0200 |
commit | 8cf5cefe6e91a5a1ed6eeaae4d94760d84c304a6 (patch) | |
tree | 7096b67b189c0220826123c7d5b121752545d140 /sfx/sfx.js | |
download | kartik-client-8cf5cefe6e91a5a1ed6eeaae4d94760d84c304a6.tar.gz kartik-client-8cf5cefe6e91a5a1ed6eeaae4d94760d84c304a6.tar.bz2 kartik-client-8cf5cefe6e91a5a1ed6eeaae4d94760d84c304a6.zip |
Presque sortie du jeu
Diffstat (limited to 'sfx/sfx.js')
-rw-r--r-- | sfx/sfx.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/sfx/sfx.js b/sfx/sfx.js new file mode 100644 index 0000000..9ed6418 --- /dev/null +++ b/sfx/sfx.js @@ -0,0 +1,60 @@ +const Sound = { + pass: () => { + new Audio(kresources.sfx['pass']).play() + }, + last: () => { + new Audio(kresources.sfx['last']).play() + }, + crash: () => { + new Audio(kresources.sfx['crash']).play() + }, + win: () => { + new Audio(kresources.sfx['win']).play() + }, + click: () => { + new Audio(kresources.sfx['click']).play() + }, + menu: () => { + new Audio(kresources.sfx['menu']).play() + }, + pause: () => { + new Audio(kresources.sfx['pause']).play() + }, + start: () => { + new Audio(kresources.sfx['start']).play() + }, + intro: () => { + new Audio(kresources.music['start'].file).play() + }, +} + +shouldMusicPlay = true; + +setInterval(() => { + try { + if (typeof document.getElementById('music') !== "undefined" && typeof document.getElementById('music') !== "null") { + if (shouldMusicPlay) { + document.getElementById('music').play(); + } + if (!shouldMusicPlay) { + document.getElementById('music').pause(); + } + } + if (typeof b !== "undefined" && typeof b !== "null") { + if (shouldMusicPlay) { + b.play(); + } + if (!shouldMusicPlay) { + b.pause(); + } + } + if (typeof me !== "undefined" && typeof me !== "null") { + if (me.currentTime < me.duration) { + me.play(); + } + if (me.currentTime >= me.duration) { + me.pause(); + } + } + } catch (e) {} +}, 200)
\ No newline at end of file |