-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
52 lines (45 loc) · 1.59 KB
/
index.html
File metadata and controls
52 lines (45 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!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="style.css" />
<script type="module" src="main.js" defer></script>
</head>
<body>
<div id="scoreBar">
<div id="score">Score: 0</div>
<div id="highScore">High Score: 0</div>
</div>
<canvas id="gameCanvas" width="400" height="400"></canvas>
<div id="mobileControls">
<div class="row">
<button onclick="changeDirection('UP')">⬆️</button>
</div>
<div class="row">
<button onclick="changeDirection('LEFT')">⬅️</button>
<button onclick="changeDirection('DOWN')">⬇️</button>
<button onclick="changeDirection('RIGHT')">➡️</button>
</div>
</div>
<div id="startScreen" class="overlay">
<h1>Welcome to Snake Game</h1>
<div id="highScoreList"></div>
<button onclick="startGame()">Start Game</button>
</div>
<div id="gameOverScreen" class="overlay" style="display: none">
<h1 id="gameOverTitle">Game Over!</h1>
<p id="finalScore"></p>
<div id="gameOverScoreList"></div>
<div id="nameInputSection" style="display: none; margin-top: 10px">
<label for="playerName">Your Name (8 chars max):</label>
<br />
<input type="text" id="playerName" maxlength="8" />
<br />
<button onclick="submitHighScore()">Submit Score</button>
</div>
<button onclick="restartGame()">Restart</button>
</div>
</body>
</html>