feat: add char selection

This commit is contained in:
sangge 2023-12-24 03:12:49 +08:00
parent 3bb0b0b753
commit 2532235a8d
2 changed files with 44 additions and 11 deletions

42
choice.html Normal file
View File

@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>角色选择</title>
<style>
.image-container {
position: relative;
display: inline-block; /* 让容器的大小适应图片 */
}
.image-container img {
width: 100%; /* 可以根据需要调整 */
height: auto;
}
.button {
position: absolute;
cursor: pointer;
width: 200px;
height: 100px;
font-size: 32px;
}
.button1 { top: 500px; left: 50px; }
.button2 { top: 500px; left: 400px; }
.button3 { top: 500px; left: 800px; }
.button4 { top: 500px; left: 1200px; }
.button5 { top: 500px; left: 1550px; }
</style>
</head>
<body>
<div class="image-container">
<img src="asset/pic/Character_Selection.png" alt="选择角色">
<button class="button button1" onclick="location.href='alexgame.html'">亚历山大</button>
<button class="button button2" onclick="location.href='louisgame.html'">路易十六</button>
<button class="button button3" onclick="location.href='qinshihuanggame.html'">秦始皇</button>
<button class="button button4" onclick="location.href='elizabethgame.html'">伊丽莎白</button>
<button class="button button5" onclick="location.href='nixongame.html'">尼克松</button>
</div>
</body>
</html>

View File

@ -31,17 +31,8 @@
<button id="start-button" onclick="startGame()"></button>
<script>
function startGame() {
// 定义游戏页面的数组
var gamePages = ['qinshihuanggame.html', 'luoisgame.html'];
// 生成一个随机索引
var randomIndex = Math.floor(Math.random() * gamePages.length);
// 使用随机索引从数组中选择一个游戏页面
var selectedGame = gamePages[randomIndex];
// 跳转到选中的游戏页面
window.location.href = selectedGame;
// 跳转
window.location.href = "choice.html";
}
</script>
</body>