-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
38 lines (35 loc) · 1.21 KB
/
app.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
31
32
33
34
35
36
37
38
const nextButton = document.querySelector(".next-button");
//svg mazes
const levelOne = document.querySelector(".level-one");
const levelTwo = document.querySelector(".level-two");
//UI MESSAGES
const uiLevel = document.querySelector(".ui-level");
const uiMessage = document.querySelector(".ui-message");
//End Game
const spookyPicture = document.querySelector(".spooky-picture");
const screamSound = document.querySelector(".scream-sound");
const collisionCheck = (value) => {
if (value === "maze-border") alert("You lost...try again.");
if (value === "finish") {
nextButton.style.opacity = 1;
nextButton.style.pointerEvents = "all";
levelOne.style.pointerEvents = "none";
}
if (value === "end-game") {
screamSound.play();
spookyPicture.style.display = "block";
document.body.style.background = "black";
}
};
window.addEventListener("mousemove", (e) => {
let check = e.target.classList.value;
collisionCheck(check);
});
nextButton.addEventListener("click", () => {
levelOne.style.display = "none";
levelTwo.style.display = "block";
nextButton.style.opacity = 0;
nextButton.style.pointerEvents = "none";
uiLevel.textContent = "Level 2";
uiMessage.textContent = "One more to go...";
});