aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.ts')
-rw-r--r--src/main.ts21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/main.ts b/src/main.ts
index 91e23ec..e20e14f 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -1,12 +1,25 @@
import "./style.css";
import "./Events";
-import loadAllImages from "./Images";
+import loadAllImages, { loadAllSounds, SOUNDS } from "./Images";
import { start } from "./game";
-import { IMGS } from "./Images"
+const btn = document.createElement("button");
async function init() {
+ await loadAllSounds();
await loadAllImages();
- console.log(IMGS.startScreen0);
- start();
+ try {
+ SOUNDS.win.volume = 0;
+ await SOUNDS.win.play()
+ SOUNDS.win.pause()
+ SOUNDS.win.volume = 1
+ SOUNDS.win.currentTime = 0;
+ start();
+ } catch (error) {
+ console.log(error);
+
+ btn.innerText = "Start da game"
+ btn.onclick = () => { btn.remove(); start(); }
+ document.body.appendChild(btn)
+ }
}
document.body.onload = init;