-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstructions.js
30 lines (25 loc) · 1015 Bytes
/
instructions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// defining all variables
let marioImage = document.getElementById("mario");
let playBtn = document.getElementById("play-button");
let homeBtn = document.getElementById("home-button-image")
let bgmAudio = new Audio("./assets/background-music.mp3")
bgmAudio.volume = 0.6;
bgmAudio.play()
bgmAudio.loop = true
// Updates marioImage source to marioWalkLarge and adjusts paddingTop for bouncy effect
setInterval(()=>{
setTimeout(()=>{
marioImage.setAttribute("src","./assets/Mario Walk - Fall/MarioStandLarge.png");
marioImage.style.paddingTop="8px";
},300)
marioImage.setAttribute("src","./assets/Mario Walk - Fall/MarioWalkLarge.png");
marioImage.style.paddingTop="12px";
},600)
// when instruction button is clicked it will redirect to index.html
homeBtn.addEventListener("click",() => {
window.open("./index.html", "_self")
})
// when play button is clicked it will redirect to theme.html
playBtn.addEventListener("click",() => {
window.open("./theme.html", "_self")
})