-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsnake.html
More file actions
73 lines (63 loc) · 3.89 KB
/
snake.html
File metadata and controls
73 lines (63 loc) · 3.89 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Snake Game</title>
<link rel="stylesheet" href="snake.css">
</head>
<body oncontextmenu="return false" onselectstart="return false" ondragstart="return false">
<button id="startButton">Start 🐍 Game</button>
<canvas id="gameCanvas" width="320" height="320" style="display: none;"></canvas>
<div id="arrowKeys" style="display: none;">
<div class="row">
<span id="upArrow" class="arrow">⇑</span>
</div>
<div class="row">
<span id="leftArrow" class="arrow">⇐</span>
<span id="downArrow" class="arrow">⇓</span>
<span id="rightArrow" class="arrow">⇒</span>
</div>
</div>
<div id="score">Score: 0</div>
<div id="pb" style="display: none;"><button id="pauseButton">⏸️</button></div>
<div id="gameOver">Game Over</div>
<button id="restartButton">🔄</button>
<div id="sb" style="display: none;">
<div class="a2a_kit a2a_kit_size_32 a2a_default_style" data-a2a-url="https://nwdevin.github.io/Dustbin/snaketest.html" data-a2a-title="Click here to play snake game 🐍 😍">
<div id="share">Share this page</div>
<a class="a2a_dd" href="https://www.addtoany.com/share"></a>
<a class="a2a_button_facebook"></a>
<a class="a2a_button_whatsapp"></a>
<a class="a2a_button_telegram"></a>
<a class="a2a_button_sms"></a>
<a class="a2a_button_email"></a>
</div>
<div id="cbox">
<input type="checkbox" class="checkbox" id="checkbox">
<label for="checkbox" class="checkbox-label">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-moon" viewBox="0 0 16 16">
<path d="M6 .278a.77.77 0 0 1 .08.858 7.2 7.2 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277q.792-.001 1.533-.16a.79.79 0 0 1 .81.316.73.73 0 0 1-.031.893A8.35 8.35 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.75.75 0 0 1 6 .278M4.858 1.311A7.27 7.27 0 0 0 1.025 7.71c0 4.02 3.279 7.276 7.319 7.276a7.32 7.32 0 0 0 5.205-2.162q-.506.063-1.029.063c-4.61 0-8.343-3.714-8.343-8.29 0-1.167.242-2.278.681-3.286"/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-sun-fill" viewBox="0 0 16 16">
<path d="M8 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8M8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0m0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13m8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5M3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8m10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0m-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0m9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707M4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708"/>
</svg>
<span class="ball"></span>
</label>
</div>
</div>
<audio id="eatSound" src="./audio/eat.mp3" type="audio/mpeg"></audio>
<audio id="gameOverSound" src="./audio/gameover.mp3" type="audio/mpeg"></audio>
<script>
const checkbox = document.getElementById("checkbox")
checkbox.addEventListener("change", () => {
document.body.classList.toggle("dark")
})
</script>
<script async src="https://static.addtoany.com/menu/page.js"></script>
<div id="ts" style="display: none;"><button id="toggleSound">🔊</button></div>
<div id="me" style="display: block;">Made with ♥ by A.G</div>
<div id="mobileMessage" style="display: block;">This game is for mobile device only</div>
<script src="snake.js"></script>
</body>
</html>