-
Notifications
You must be signed in to change notification settings - Fork 3
/
game.html
179 lines (157 loc) · 8.13 KB
/
game.html
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!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="styles.css">
</head>
<!-- <audio controls autoplay>
<source autoplay="true" src="audio.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio> -->
<body>
<div id="notif" style="width: 100%; height: 50px; padding: 0px; float: left; background: rgba(255, 0, 0, 0.689); display: none"></div>
<ul>
<li><a href="https://skparab1.github.io"><h7 id="header">Home</h7></a></li>
<li><a href="https://skparab1.github.io/wordle/random"><h7 id="header1">Wordle</h7></a></li>
<li><a href="https://skparab1.github.io/snake"><h7 id="header2">Snake</h7></a></li>
</ul>
<h1 id="header3">Snake game</h1>
<!div class="center" style="width: 100%">
<div id="leftpanel" style="float: right; position: absolute; text-align: center; left: 25px; top: 100px; width: 22.5%">
<h1 style="color: white" id="settings">Settings</h1>
<div style="width: 100%">
<div style="text-align: center; width: 50%; float: left; padding-top: 14px;">
<label class="switch" style="width: 135px">
<input type="checkbox" onclick="toggletheme();">
<span class="slider round"></span>
<span class="labels" data-on="ON" data-off="OFF"></span>
</label>
</div>
<div style="text-align: center; width: 50%; float: left; padding-bottom: 1px;">
<h2 style="color: white" id="themedisp">Theme: Dark</h2>
</div>
</div>
<br>
<div style="width: 100%;">
<div style="text-align: center; width: 50%; float: right;">
<h2 style="color: white" id="ap notif">Autopilot: Off</h2>
</div>
<div style="text-align: center; width: 50%; float: left; padding-top: 8px; padding-bottom: 50px;">
<button id="playbtn7" class="game-key" style="width: 90%" onclick="toggleautopilot();">Enable autopilot</button>
</div>
</div>
<div style="width: 100%; float: right">
<div style="text-align: center; width: 50%; float: left;">
<button id="starter1" class="game-key" onclick="openintro();" style="width: 90%">Main menu</button>
</div>
<div style="text-align: center; width: 50%; float: right;">
<button id="starter1" class="game-key" onclick="opencredits();" style="width: 90%">Contributers</button>
</div>
<br><br><br>
</div>
<br><br><br>
<div style="width: 100%; float: right">
<div style="text-align: center; width: 50%; float: left;">
<a href="https://skparab1.github.io/snake/leaderboard.html">
<button id="leaderboarder" class="game-key" style="width: 90%">Leaderboard</button>
</a>
</div>
<div style="text-align: center; width: 50%; float: right; padding-bottom: 50px;">
<button id="starter1" class="game-key" onclick="opensnake();" style="width: 90%">Customize snake</button>
</div>
</div>
<div style="width: 100%; float: right; padding-bottom: 0px;">
<h1 style="padding-bottom: 0px;">Audio controls</h1>
<div style="text-align: center; width: 30%; float: right; padding-top: 10px;">
<button id="audiobtn" class="game-key" onclick="togglemusic();" style="width: 90%;">Pause music</button>
</div>
<div style="text-align: center; width: 70%; float: left;">
<div style="text-align: center; width: 10%; float: left; padding-top: 10px;">
<h3 style="color: white; padding-top: 0px;">Volume: </h3>
</div>
<div style="text-align: center; width: 90%; float: right; padding-top: 25px;">
<input type="range" class="range" min="1" max="100" value="100" id="volume-control">
</div>
</div>
</div>
</div>
<div style="float: left">
<canvas class="myCanvas">
<p>Rip ur browser doesnt support canvas :(( u shud switch to a better browser...</p>
<canvas id="the-canvas" width="320" height="240" style="position:relative; right:300px;"></canvas>
</canvas>
</div>
<script type="module" src="sender.js">import { Octokit } from "https://cdn.skypack.dev/@octokit/core";</script>
<script src="canvas-controller.js"></script>
<!button id="door" class="opener"></button>
<div id="endgame-display" style="position: absolute; left: 500px; top: 100px; display: none">
<button class="endgame-key" id="play_again" onclick="window.location.reload();" >Play again</button>
</div>
<div id="endgame-display2" style="position: absolute; left: 500px; top: 100px; display: none">
<h2 style="color: rgb(0,100,0); text-align: center" id="endgamenotif">GAME OVER</h1>
<h3 style="color: rgb(0,100,0); text-align: center" id="endgamenotif2">Score: </h1>
<h3 style="color: rgb(0,100,0); text-align: center" id="endgamenotif3">Time alive: </h1>
</div>
<div id="endgame-display1" style="position: absolute; left: 500px; top: 100px; display: none">
<a href="https://skparab1.github.io/snake/leaderboard.html">
<button class="endgame-key" id="leaderboard">Leaderboard</button>
</a>
<button class="endgame-key" id="leaderboard2" style="display: none">Send score</button>
</div>
<div class="empty" id="all" style="display: none;">
<h1 style="color: white" id="namedisplay">Name: </h1>
<h1 id="score">Score: 0</h1>
<h1 id="best">Best: 0</h1>
<h1 id="time">Time: 0 sec</h1>
<h1 id="display">Press any key to start</h1><br>
<br>
<h1 style="color:white" id="gc"> Game controls</h1>
<button id="playbtn1" class="blank-key"></button>
<button id="playbtn2" class="game-key" onclick="up();">↑</button>
<button id="playbtn3" class="blank-key"></button>
<br>
<button id="playbtn4" class="game-key" onclick="left();">←</button>
<button id="playbtn5" class="game-key" onclick="down();">↓</button>
<button id="playbtn6" class="game-key" onclick="right();">→</button>
<br>
</div>
<div id="introducer-cover" style="position: absolute; background-color: #AAAAAA;">
<h1></h1>
</div>
<div id="introducer" style="position: absolute; background-color: #AAAAAA; opacity: 0%">
<h1 style="color: black; text-align: center">Welcome to Snake Game!</h1>
<h1 style="color: black; text-align: center">How to play:</h1>
<h2 style="color: black; text-align: center">1. Use Arrow keys or wasd to navigate the snake around</h2>
<h2 style="color: black; text-align: center">2. Eat all the apples and grow your snake</h2>
<h2 style="color: black; text-align: center">3. Don't crash into yourself or the wall</h2>
<div style="text-align: center">
<label style="color: black; text-align: center"><h2>Enter your name: </h2><input id="name"></input></label>
<br>
<br>
<button id="starter" onclick="closeintro();" class="game-key" style="width: 25%">Ok</button>
</div>
</div>
<div id="credits" style="position: absolute; background-color: #AAAAAA; opacity: 0%">
<h1 style="color: black; text-align: center">Contributers</h1>
<h2 style="color: black; text-align: center">Developers: Shubham Parab, Anindit Pati, Agastya Pawate, and Anish Lakkapragada</h2>
<h2 style="color: black; text-align: center">Design: Anindit Pati and Shubham Parab</h2>
<h2 style="color: black; text-align: center">Music: Advaita Guruprasad</h2>
<div style="text-align: center">
<button id="starter" onclick="closecredits();" class="game-key" style="width: 25%">Close</button>
</div>
</div>
<div id="snakestyle" style="position: absolute; background-color: #AAAAAA; opacity: 0%">
<h1 style="color: black; text-align: center">Customize snake</h1>
<div style="text-align: center">
<label for="colorpicker">Color Picker:</label>
<input type="color" id="colorpicker" value="#0000ff">
</div>
<div style="text-align: center">
<button id="starter" onclick="closesnake();" class="game-key" style="width: 25%">Close</button>
</div>
</div>
<script src="html-controller.js"></script>
</body>
</html>