From e84eb8044dc602f06497e8255e62b32566b44e16 Mon Sep 17 00:00:00 2001 From: sangge <2251250136@qq.com> Date: Tue, 12 Dec 2023 22:32:16 +0800 Subject: [PATCH] feat: update new asset --- css/game.css | 46 ++++++++++++++++++++++++++++++++-------------- game.html | 5 +++++ js/game.js | 34 ++++++++++++++++++++-------------- 3 files changed, 57 insertions(+), 28 deletions(-) diff --git a/css/game.css b/css/game.css index 0a36444..43c17a0 100644 --- a/css/game.css +++ b/css/game.css @@ -1,6 +1,7 @@ body { background-image: url('../asset/pic/qinshihuang/background.png'); background-repeat: no-repeat; + background-color: rgb(0, 136, 109); } #desktop{ position: absolute; @@ -14,7 +15,7 @@ width: 1024px; height: 1024px; top:50px; - left: 0px; + left: -100px; } #restaurant .dish img { position: absolute; @@ -28,7 +29,7 @@ position: absolute; width: 800px; height: 800px; - z-index: 3; + z-index: 4; } #qinshihuang img{ /* 秦始皇 */ @@ -61,18 +62,23 @@ #dialogueBox img{ position: absolute; - width: 512px; - height: 670px; + width: 800px; + height: 800px; + top: -100px; + left: -100px; display: none; } #dialogueText { position: absolute; - top: 200px; + top: 170px; left: 100px; - width: 340px; - height: 128px; - font-size: 40px; + width: 400px; + height: 150px; + font-size: 25px; + text-align: center; /* 水平居中 */ + } + # #customer1 img{ /* 中年男 */ display: none; } @@ -83,39 +89,51 @@ display: none; } #customer2 img{ /* 小女孩 */ + top:150px !important; display: none; } #customer2-2 img{ /* unhappy小女孩 */ + top:150px !important; display: none; } #customer2-3 img{ /* angry小女孩 */ + top:150px !important; display: none; } #customer3 img{ /* 老奶奶 */ + top:100px !important; display: none; } - #customer3-2 img{ /* 老奶奶 */ + #customer3-2 img{ /* unhappy老奶奶 */ + top:100px !important; display: none; } - #customer3-3 img{ /* 老奶奶 */ + #customer3-3 img{ /* unhappy老奶奶 */ + top:100px !important; display: none; } #mapo-tofu img{ /* 麻婆豆腐 */ + left: 630px; display: none; } #roast-duck img{ /* 烤鸭 */ - left: 250px; + left: 850px; + top: 620px !important; + width: 340px !important; + height: 340px !important; display: none; } #yangzhou-fried-rice img{ - left: 485px; + left: 250px; + top: 730px !important; + width: 200px !important; + height: 200px !important; display: none; } #braised-prawns img{ - left: 700px; + left: 430px; display: none; } #kung-pao-chicken img{ - left: 900px; display: none; } diff --git a/game.html b/game.html index d62c3b4..e7b0711 100644 --- a/game.html +++ b/game.html @@ -34,6 +34,11 @@
+
+提示 +
+
+
diff --git a/js/game.js b/js/game.js index 9806a9b..a2d6ffc 100644 --- a/js/game.js +++ b/js/game.js @@ -42,10 +42,16 @@ function handleClick(dishName) { console.log("恭喜,你选对了!"); if (currentIndex == 9){ setTimeout(function() { - window.location.href = 'gameover.html'; + window.location.href = 'win.html'; }, 2000); }else{ + // customer calm down + hideElement(customers[RandomCustomerIndex][failedTimes]); + failedTimes = 0; + showElement(customers[RandomCustomerIndex][0]); + + // display next question currentIndex = currentIndex + 1 var nextQuestion = questions[QAlist[currentIndex]]; document.getElementById("dialogueText").innerHTML = nextQuestion; @@ -55,7 +61,7 @@ function handleClick(dishName) { } else { // 错误答案的处理逻辑 console.log("不幸,这不是正确答案。"); - failedTimes = failedTimes + 1 + failedTimes = failedTimes + 1; switch (failedTimes) { case 1: hideElement(customers[RandomCustomerIndex][0]) @@ -70,30 +76,30 @@ function handleClick(dishName) { showElement(qinshihuangs[RandomQinShiHuangIndex]) // Delay for 2 seconds before redirecting setTimeout(function() { - window.location.href = 'gameover.html'; + window.location.href = 'lose.html'; }, 2000); // 这里可以添加结束游戏或其他逻辑 break; default: console.log("失败次数:" + failedTimes); + } } } -} var failedTimes = 0 // Questions list var questions = [ - "如何建立统一的度量衡体系以加强中央集权?", - "如何制定合理的税收政策来增强国库?", - "如何组织和动员资源建造长城以防御外敌?", - "如何执行禁止私人持有武器的政策?", - "如何推广统一的书写系统来加强文化统一?", - "如何合理征召士兵并保持军队的高效运作?", - "如何处理与儒家思想相关的政治异见?", - "如何加强皇帝的集权制度?", - "如何建立和维护一个有效的道路交通网络?", - "如何处理与周边国家的外交关系?" + "How to establish a unified system of metrics to strengthen centralised power?", + "How to formulate a reasonable tax policy to strengthen the national treasury?", + "How to organise and mobilise resources for the construction of the Great Wall to defend against foreign enemies?", + "How to enforce the policy of prohibiting private ownership of weapons?", + "How to promote a uniform writing system to strengthen cultural unity?", + "How to recruit soldiers wisely and keep the army running efficiently?", + "How to deal with political dissent arising from different ideas?", + "How to strengthen the centralised power system of the emperor?", + "How to establish and maintain an effective road transport network?", + "How to handle diplomatic relations with neighbouring countries?" ]; // Answers list