From cb448f07f66d51beee8c7f864da9127861da5a64 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sat, 3 Dec 2022 22:54:48 +0100 Subject: [PATCH] add main theme --- .gitignore | 4 ++++ assets/music/SOURCES.md | 3 +++ js/Env.js | 5 +++++ js/Game.js | 3 +++ 4 files changed, 15 insertions(+) create mode 100644 assets/music/SOURCES.md diff --git a/.gitignore b/.gitignore index 7f4c97b..d59cb5a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,11 @@ js/lib/* + assets/images/* !assets/images/*.md +assets/music/* +!assets/music/*.md + report/* !report/*.tex diff --git a/assets/music/SOURCES.md b/assets/music/SOURCES.md new file mode 100644 index 0000000..38258ed --- /dev/null +++ b/assets/music/SOURCES.md @@ -0,0 +1,3 @@ +| Music | URL | +| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| theme.wav | https://www.beepbox.co/#9n31s0k0l00e02t2ma7g0fj07r1i0o432T1v1u16f0q00d03A0F0B0Q0000Pff00E1617T1v6u60f0q0x10h51d19AbF8B7Q0471Peb9aE2b676T1v7ue1f0q0y10n73d4aA0F0B7Q0000Pe600E2bb619T3v4uf7f0qwx10m711d08SZIztrsrzrqiiiiiE1b6b4z000000000h400000000000000000004h000000000p22mFH_gGqfi5Oo7bOldjRV1jnUaqfHA4OZ5dl50KhAQk2VmjhgbBYFhhhBpt556jlBQkkpB0aqfo1HQk5d1jhgnQ0bdvWAjbMbibihQV4V17jihQV4V17jjq_2C-6V1fW3N8aqcgnSTkSlSlSkSlSlS00 | diff --git a/js/Env.js b/js/Env.js index 8ffb798..506e9cd 100644 --- a/js/Env.js +++ b/js/Env.js @@ -43,6 +43,10 @@ export class Env { // Clock this.clock = new THREE.Clock(); + + // Music player + this.music = new Audio("./assets/music/theme.wav"); + this.music.loop = true; } /** @@ -124,6 +128,7 @@ export class Env { ) { // If animation returned false, the player died! playerDead = true; + this.music.pause(); } } }); diff --git a/js/Game.js b/js/Game.js index 860a753..b1d7e13 100644 --- a/js/Game.js +++ b/js/Game.js @@ -109,6 +109,9 @@ export const runGame = (demo) => { requestAnimationFrame(animate); }; + // Start music + env.music.play(); + // Run it animate(); };