-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
40 lines (35 loc) · 985 Bytes
/
index.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
39
40
if(!localStorage.length){
welcomeButton.addEventListener('click', ()=>{
if(!username.value){
alert('Please Enter A Name');
}else {
localStorage.setItem('User', username.value);
localStorage.setItem('Level', level[index]);
localStorage.setItem('Index', index)
welcomePage.classList.add('hidden');
setInfo();
userInfo.classList.remove('hidden');
generateMaze();
}
})
} else
{
setInfo();
welcomePage.classList.add('hidden');
welcomeBackPage.classList.remove('hidden');
}
newGameButton.addEventListener('click', ()=>{
welcomeBackPage.classList.add('hidden');
index = 0;
localStorage.setItem('Index', index);
console.log(index)
userInfo.classList.remove('hidden')
setInfo();
generateMaze();
})
continueButton.addEventListener('click', ()=>{
welcomeBackPage.classList.add('hidden')
setInfo()
userInfo.classList.remove('hidden')
generateMaze();
})