diff options
| author | Maksymilian Jopek <maks@jopek.eu> | 2022-06-02 23:13:07 +0200 |
|---|---|---|
| committer | Maksymilian Jopek <maks@jopek.eu> | 2022-06-02 23:16:33 +0200 |
| commit | b4defa324a330217f0139f1240bcf53c0b1f996a (patch) | |
| tree | deabb94fd351b10d3d6b38d967424149536b3927 /src/main.ts | |
| parent | ef76266d1a61c02f1721efedc830fab12279d2b9 (diff) | |
| download | 1942-b4defa324a330217f0139f1240bcf53c0b1f996a.tar.gz 1942-b4defa324a330217f0139f1240bcf53c0b1f996a.tar.zst 1942-b4defa324a330217f0139f1240bcf53c0b1f996a.zip | |
v1.0.0
Diffstat (limited to 'src/main.ts')
| -rw-r--r-- | src/main.ts | 21 |
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; |
