Added good game ending instead of looping

This commit is contained in:
Mattia Mascarello 2024-04-19 10:34:00 +02:00
parent d26abea6a7
commit 5ee2c88341
4 changed files with 30 additions and 7 deletions

Binary file not shown.

View File

@ -43,7 +43,8 @@ body {
left: 0px; left: 0px;
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
z-index: 1; /*hide baby*/ z-index: 1;
/*hide baby*/
} }
#playBegin { #playBegin {
@ -67,6 +68,7 @@ body {
display: none; display: none;
} }
.floatright { .floatright {
position: absolute; position: absolute;
right: 2%; right: 2%;
@ -104,7 +106,9 @@ body {
z-index: 2; z-index: 2;
} }
#mao>img, #xi>img, #square>img { #mao>img,
#xi>img,
#square>img {
width: 30vw; width: 30vw;
margin-top: 10vh; margin-top: 10vh;
} }
@ -113,4 +117,14 @@ body {
background-color: black; background-color: black;
display: none; display: none;
z-index: 10; z-index: 10;
font-size: 30px;
padding-top: 20vh;
}
#win {
background-color: red;
display: none;
z-index: 10;
font-size: 30px;
padding-top: 20vh;
} }

View File

@ -76,6 +76,13 @@
<i>Thanks for playing</i><br /> <i>Thanks for playing</i><br />
<a href="javascript:location.reload()">Play again</a> <a href="javascript:location.reload()">Play again</a>
</div> </div>
<div id="win" class="floattop">
<h1>Congratulations!</h1>
<p>Your social credit score is high enough</p>
<p>You are worthy of the Chinese Dream</p>
<i>Thanks for playing</i><br />
<a href="javascript:location.reload()">Play again</a>
</div>
</div> </div>
<script src="js/jquery-3.6.0.min.js"></script> <script src="js/jquery-3.6.0.min.js"></script>
<script src="js/util.js"></script> <script src="js/util.js"></script>

View File

@ -77,9 +77,11 @@ function displayQuestion() {
indexesProgress++; indexesProgress++;
} }
else { else {
shuffle(indexeslist); audio.pause();
indexesProgress = 0; sef("applause");
index = 0; audio = new Audio('assets/music/march_vol_charged.mp3');
audio.play();
$("#win").show();
} }
cQuestion = data["questions"][index]; cQuestion = data["questions"][index];
$("[data-ans=1]").html(data["questions"][index]["answers"][0]["text"]); $("[data-ans=1]").html(data["questions"][index]["answers"][0]["text"]);