From 447915d2777a702b48fe430b6f2150d627045596 Mon Sep 17 00:00:00 2001
From: sangge <2251250136@qq.com>
Date: Tue, 12 Dec 2023 23:28:56 +0800
Subject: [PATCH] feat: finish game
---
.../{hint_buttom.png => hint_bottom.png} | Bin
css/game.css | 22 +++++++++++++-
game.html | 28 +++++++++++-------
js/game.js | 16 ++++++++++
lose.html | 4 ++-
win.html | 2 ++
6 files changed, 59 insertions(+), 13 deletions(-)
rename asset/pic/qinshihuang/{hint_buttom.png => hint_bottom.png} (100%)
diff --git a/asset/pic/qinshihuang/hint_buttom.png b/asset/pic/qinshihuang/hint_bottom.png
similarity index 100%
rename from asset/pic/qinshihuang/hint_buttom.png
rename to asset/pic/qinshihuang/hint_bottom.png
diff --git a/css/game.css b/css/game.css
index 43c17a0..a215c29 100644
--- a/css/game.css
+++ b/css/game.css
@@ -78,7 +78,27 @@
text-align: center; /* 水平居中 */
}
- #
+ #hint {
+ position: absolute;
+
+ width: 50px;
+ height: 50px;
+ top: 350px;
+ left: 1100px;
+
+ }
+#hint img{
+ position: absolute;
+ width: 50px;
+ height: 50px;
+ z-index: 5;
+ display: none;
+ }
+ #hintpage img{
+ position: absolute;
+ z-index: 5;
+ display: none;
+ }
#customer1 img{ /* 中年男 */
display: none;
}
diff --git a/game.html b/game.html
index e7b0711..a5b374d 100644
--- a/game.html
+++ b/game.html
@@ -34,13 +34,14 @@
-
-

-
-
-
-
+
+
+

+
+
+

+
@@ -71,19 +72,24 @@
-

+
-

+
-

+
-

+
-

+
diff --git a/js/game.js b/js/game.js
index a2d6ffc..cde4770 100644
--- a/js/game.js
+++ b/js/game.js
@@ -35,6 +35,19 @@ function checkAnswer(dishName){
return answer == dishName
}
+function handleHint(hint) {
+ console.log(hint + " 被点击了!");
+ if (hint == "bottom") {
+ hideElement("#hint img")
+ showElement("#hintpage img")
+ }
+ if (hint == "page") {
+ hideElement("#hintpage img")
+ showElement("#hint img")
+ }
+
+}
+
function handleClick(dishName) {
console.log(dishName + " 被点击了!");
if (checkAnswer(dishName)){
@@ -150,6 +163,9 @@ document.addEventListener("DOMContentLoaded", function() {
// Show normal Qin Shi Huang
showElement('#qinshihuang img');
+ // Show hint bottom
+ showElement('#hint img')
+
// Show first question
var randomQuestion = questions[QAlist[currentIndex]];
document.getElementById("dialogueText").innerHTML = randomQuestion;
diff --git a/lose.html b/lose.html
index 9d35626..c178ebe 100644
--- a/lose.html
+++ b/lose.html
@@ -8,7 +8,7 @@
body {
text-align: center;
padding-top: 50px;
- background-image: url("asset/pic/lose.jpg");
+ background-image: url("asset/pic/lose.png");
background-repeat: no-repeat;
}
.btn {
@@ -19,6 +19,8 @@
color: white;
text-decoration: none;
border-radius: 5px;
+ top: 350px;
+ left: 825px;
}
h1 {
position: absolute;
diff --git a/win.html b/win.html
index a6899f1..4cdf37a 100644
--- a/win.html
+++ b/win.html
@@ -19,6 +19,8 @@
color: white;
text-decoration: none;
border-radius: 5px;
+ top: 350px;
+ left: 825px;
}
h1 {
position: absolute;