summaryrefslogtreecommitdiff
path: root/kartik/sfx/sfx.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-05-18 18:50:12 +0200
committerMinteck <contact@minteck.org>2022-05-18 18:50:12 +0200
commit0bd45cb2cae3af05adaad3f38d129bb67c3e0ec0 (patch)
tree97a7e15187fe7fcb5b8775e03a62f62ac8fc5c61 /kartik/sfx/sfx.js
parentd4805039b8ea7b30f5e78cf53caf8fd3f267256a (diff)
downloadarcade-0bd45cb2cae3af05adaad3f38d129bb67c3e0ec0.tar.gz
arcade-0bd45cb2cae3af05adaad3f38d129bb67c3e0ec0.tar.bz2
arcade-0bd45cb2cae3af05adaad3f38d129bb67c3e0ec0.zip
Add KartikHEADtrunk
Diffstat (limited to 'kartik/sfx/sfx.js')
-rwxr-xr-xkartik/sfx/sfx.js60
1 files changed, 60 insertions, 0 deletions
diff --git a/kartik/sfx/sfx.js b/kartik/sfx/sfx.js
new file mode 100755
index 0000000..9ed6418
--- /dev/null
+++ b/kartik/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