AI 生成: A classic Snake game built with HTML, CSS, and JavaScript. Control the snake to eat food, grow longer, and avoid hitting walls or yourself.

This commit is contained in:
admin
2026-10-01 19:31:11 +08:00
commit f43f5795e9
4 changed files with 318 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Snake Game</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="game-container">
<h1>Snake Game</h1>
<div class="score-board">
<span>Score: <span id="score">0</span></span>
<span>High Score: <span id="high-score">0</span></span>
</div>
<canvas id="gameCanvas" width="400" height="400"></canvas>
<div class="controls">
<button id="restartBtn">Restart</button>
</div>
<p class="hint">Use arrow keys or WASD to move</p>
</div>
<script src="js/game.js"></script>
</body>
</html>