-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
163 lines (153 loc) · 8.14 KB
/
script.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
let ornstein = 'https://img-9gag-fun.9cache.com/photo/ayxQpop_700bwp.webp'
let artorias = 'https://res.cloudinary.com/cook-becker/image/fetch/q_auto:best,f_auto,w_1920,e_sharpen/https://candb.com/site/candb/images/artwork/Dark-Souls-Artorias-of-the-Abyss_Nekro-Bandai-1600.jpg'
let solaire = 'https://i.kym-cdn.com/photos/images/newsfeed/000/692/868/558.jpg'
let siegmeyer = 'https://giantbomb1.cbsistatic.com/uploads/scale_small/12/120355/2283627-sig.jpg'
let seath = 'https://i1.sndcdn.com/artworks-000552370749-mdfohk-t500x500.jpg'
let mirrorKnight = 'https://66.media.tumblr.com/468694ded87230e73d756e7dd9788832/tumblr_nh36kbZ6q61skceqmo1_500.jpg'
let midir = 'https://vignette.wikia.nocookie.net/darksouls/images/6/6c/Midir_rises_%282%29.jpg/revision/latest?cb=20170404185337'
let yhorm = 'https://bbts1.azureedge.net/images/p/full/2019/10/43f823e0-dde6-4180-b3c8-237159cf36b0.jpg'
let nameless = 'https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/bbb2559b-70e8-45e9-8491-e19a0b3eddf6/da01hod-8172a926-bd6a-4c11-a519-775bdb2b7594.jpg?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7InBhdGgiOiJcL2ZcL2JiYjI1NTliLTcwZTgtNDVlOS04NDkxLWUxOWEwYjNlZGRmNlwvZGEwMWhvZC04MTcyYTkyNi1iZDZhLTRjMTEtYTUxOS03NzViZGIyYjc1OTQuanBnIn1dXSwiYXVkIjpbInVybjpzZXJ2aWNlOmZpbGUuZG93bmxvYWQiXX0.fQIQ4l3x89mITNo1AJ1altzCT9QLdO61btij6snygwQ'
let gael = 'https://images-cdn.9gag.com/photo/adLpX2B_460s.jpg'
let lorian = 'https://cdna.artstation.com/p/assets/images/images/005/765/118/large/fadly-romdhani-lorian-lothric-fan-art.jpg?1493626239'
let crystalSage = 'https://cdna.artstation.com/p/assets/images/images/009/590/308/large/storm-ruler-s1-2.jpg?1519830207'
let capraDemon = 'https://i.pinimg.com/originals/a1/6b/a5/a16ba55a38c86709d245a27a2493ea11.png'
let taurusDemon = 'https://i.pinimg.com/originals/d1/fd/4d/d1fd4d1929158b0d6e01140043a85486.jpg'
let asylumDemon = 'https://cdna.artstation.com/p/assets/images/images/002/496/246/large/eh-macmillan-asylum-demon.jpg?1462425061'
let questions = [{
question: "A Dragon Slayer loyal to lord Gwyn and one of his four knights, he and executioner Smough gaurd the ruined cathedral",
answers: [ornstein, solaire, mirrorKnight, lorian],
correct: 0
},
{
question: "A skilled knight of Lothric in his past, Before he embraced his brother's curse, he was a knight who single handedly slayed the demon prince, but the victory eternally scorched his sword with flame, the curse left him crippled and mute.",
answers: [taurusDemon, lorian, mirrorKnight, gael],
correct: 1
},
{
question: "A knight, who challenges visitors to the lordless castle. Long ago, the King's Passage was a route taken by the bravest warriors to prove themselves, but now it only prevents one from pursuing the runaway king.",
answers: [capraDemon, yhorm, mirrorKnight, asylumDemon],
correct: 2
},
{
question: "This mage once served as spiritual guides to the scholars of the Grand Archives and one went on to ally with the Undead Legion of Farron.",
answers: [siegmeyer, solaire, crystalSage, yhorm],
correct: 2
},
{
question: "An uncle-like figure to the Painter. Though his exact relation is unknown, he certainly resided in the Painted World for some time, at least until the Painter was locked up.",
answers: [gael, seath, taurusDemon, lorian],
correct: 0
},
{
question: "Also known as the 'Abysswalker', was one of the four knights of Gwyn. His grave, marked with his greatsword, is placed at the Oolacile Sanctuary area (later known as the Darkroot Garden) and is guarded by Sif",
answers: [capraDemon, nameless, mirrorKnight, artorias],
correct: 3
},
{
question: "This demon resides in the Lower Undead Burg. It is a lesser demon resembling a human with a goat's head, wielding two large machetes",
answers: [taurusDemon, solaire, capraDemon, yhorm],
correct: 2
},
{
question: "A Lord of Cinder, and the only giant among them, he likely chose to link the flame because of his sense of duty and loyalty to the people he ruled.",
answers: [asylumDemon, yhorm, nameless, artorias],
correct: 1
},
{
question: "Once a God of War, and was said to have respect only for arms and nothing else, and wielded the Sunlight Blade and Great Lightning Spear miracles. At some point, he sacrificed everything to ally himself with the Ancient Dragons.",
answers: [nameless, taurusDemon, seath, lorian],
correct: 0
},
{
question: "This demon is located on the walkway after ascending the tower with the spiral staircase in the Undead Burg. It wields a massive greataxe",
answers: [midir, mirrorKnight, gael, taurusDemon],
correct: 3
},
{
question: "A descendant of Archdragons, raised by the gods, and owing to his immortality was given a duty to eternally battle the dark, a duty that he would never forget, even after the gods perished.",
answers: [seath, midir, asylumDemon, solaire],
correct: 1
},
{
question: "A member of the Warriors of Sunlight covenant. He is a cheerful and powerful knight who does not let the crumbling world affect his mood. He speaks of willingly becoming an Undead so that he could search for his own sun.",
answers: [nameless, mirrorKnight, solaire, seath],
correct: 2
},
{
question: "A knight from Catarina who has come to Lordran seeking adventure and excitement, though he isn't totally prepared for it, and his daughter, Sieglinde, is against it",
answers: [siegmeyer, gael, lorian, crystalSage],
correct: 0
},
{
question: "This demon was created by the Bed of Chaos and ensures that only the most powerful Undead are able to escape the Northern Undead Asylum.",
answers: [taurusDemon, gael, yhorm, asylumDemon],
correct: 3
},
{
question: "A dragon without scales therefore lacking immortality, granted the title of Duke by Lord Gwyn for his assistance in defeating the Everlasting Dragons. He was also given a fragment of a Lord Soul along with his dukedom.",
answers: [taurusDemon, seath, siegmeyer, midir],
correct: 1
}]
let a = document.querySelector('#first')
let b = document.querySelector('#second')
let c = document.querySelector('#third')
let d = document.querySelector('#fourth')
let picture = document.querySelectorAll('.picture')
let button = document.querySelector('.overlayButton')
let questionText = document.querySelector('.question')
let questionBox = document.querySelector('.questionBox')
let answerButton = document.querySelectorAll('.option')
let turn = 0;
let display = document.querySelector('.displayBox')
let welcomeButton = document.querySelector('.welcomeButton')
// for(let i=0; i<picture.length; i++){
// picture[i].addEventListener('click', checkAnswer)
// }
// function checkAnswer(){
// if(event.target.dataset.number == questions[i].correct){
// alert("Good job")
// }
// }
a.setAttribute('src', questions[turn].answers[0])
b.setAttribute('src', questions[turn].answers[1])
c.setAttribute('src', questions[turn].answers[2])
d.setAttribute('src', questions[turn].answers[3])
questionText.innerText=questions[turn].question
function changeAnswer(){
if(turn === 15){
document.querySelector('.winMessage').style.right = '3%'
}
else{
a.setAttribute('src', questions[turn].answers[0])
b.setAttribute('src', questions[turn].answers[1])
c.setAttribute('src', questions[turn].answers[2])
d.setAttribute('src', questions[turn].answers[3])
questionText.innerText=questions[turn].question
}
document.querySelector('.score').innerText = `Score: ${turn} `
}
for(let i=0; i<picture.length; i++){
picture[i].addEventListener('click', function(event){
if(event.target.dataset.number == questions[turn].correct){
turn++
document.querySelector('.wrongAnswer').style.display = "none"
changeAnswer();
return turn;
}
else{
document.querySelector('.wrongAnswer').style.display = "block"
// alert("try again")
}
})
}
button.addEventListener('click', function(){
document.querySelector('.overlay').style.left = "-100%"
document.querySelector('.overlay').style.opacity = "0"
document.querySelector('.audio').play();
questionText.style.right = '0'
display.style.height = '30vh'
})
welcomeButton.addEventListener('click', function(){
document.querySelector('.welcome').style.left = '-100%'
document.querySelector('.fire').play();
})