c4c48d17b4
- 贪吃蛇游戏: Canvas渲染、方向控制、碰撞检测、计分系统 - 记忆配对纸牌: 3D翻转动画、配对消除、计时器、胜利判定
51 lines
1.5 KiB
HTML
51 lines
1.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>贪吃蛇大作战</title>
|
|
<style>
|
|
body {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
height: 100vh;
|
|
margin: 0;
|
|
background: radial-gradient(circle, #2c3e50, #000);
|
|
color: white;
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
overflow: hidden;
|
|
}
|
|
#game-container {
|
|
position: relative;
|
|
padding: 10px;
|
|
background: rgba(255, 255, 255, 0.05);
|
|
border-radius: 15px;
|
|
box-shadow: 0 0 30px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.1);
|
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
}
|
|
canvas {
|
|
border-radius: 8px;
|
|
display: block;
|
|
}
|
|
#score-board {
|
|
font-size: 28px;
|
|
font-weight: bold;
|
|
margin-bottom: 20px;
|
|
text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
|
|
letter-spacing: 2px;
|
|
}
|
|
#score {
|
|
color: #2ecc71;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="score-board">分数: <span id="score">0</span></div>
|
|
<div id="game-container">
|
|
<canvas id="snakeGame" width="400" height="400"></canvas>
|
|
</div>
|
|
<script src="game.js"></script>
|
|
</body>
|
|
</html> |