feat: add sounds after game end
This commit is contained in:
parent
326f313a0e
commit
ca7ee140fb
BIN
src/assets/music/Super Mario Bros. Music - Level Complete.mp3
Normal file
BIN
src/assets/music/Super Mario Bros. Music - Level Complete.mp3
Normal file
Binary file not shown.
@ -1,4 +1,5 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Jersey+15&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap');
|
||||
|
||||
*{
|
||||
font-family: "Jersey 15", sans-serif;
|
||||
margin: 0;
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
<audio id="bgm" src="/assets/music/game.mp3" loop autoplay></audio>
|
||||
<audio id="sfx" src="/assets/music/slash.mp3"></audio>
|
||||
<audio id="sfxhrt" src="/assets/music/hurt.mp3"></audio>
|
||||
<audio id="win" src="/assets/music/Super Mario Bros. Music - Level Complete.mp3"></audio>
|
||||
<div class="container-first">
|
||||
<div class="content">
|
||||
<div class="boss">
|
||||
|
||||
@ -107,9 +107,7 @@ function selectAnswer(e){
|
||||
bgm.play()
|
||||
|
||||
if(wrongCount >= maxWrong){
|
||||
setTimeout(()=>{
|
||||
showScore();
|
||||
}, 500);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -127,13 +125,15 @@ function showScore(){
|
||||
document.getElementById("h1").remove();
|
||||
document.getElementById("h2").remove();
|
||||
document.getElementById("h3").remove();
|
||||
setTimeout(()=> {
|
||||
const bgm = document.getElementById("sfxhrt");
|
||||
const bgm = document.getElementById("win");
|
||||
bgm.play()
|
||||
setTimeout(()=> {
|
||||
const alerts = document.getElementById("scoreAlert")
|
||||
alerts.textContent = `you scored ${score} out of 200 !`;
|
||||
}, 600);
|
||||
}, 200);
|
||||
setTimeout(()=> {
|
||||
postScore(score);
|
||||
}, 3200);
|
||||
}
|
||||
|
||||
function handleNextBtn(){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user