-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.html
239 lines (215 loc) · 8.21 KB
/
index.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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<!DOCTYPE html>
<html>
<head>
<title>Wanshot</title>
<link rel = "icon" href = "icons/favicon.png">
<meta property = "og:title" content = "Wanshot">
<meta property = "og:image" content = "https://dkeree.github.io/Wanshot/icons/favicon.png">
<meta property = "og:description" content = "Have you ever wanted to play as a little blue boi and wipe out the entire US military? This is the game for you! Try to beat all 20 levels in one go at the risk of your own blood pressure!">
<link href = "style.css" rel = "stylesheet" type = "text/css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300&display=swap" rel="stylesheet">
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
console.log('%cThanks For Playing Wanshot!', 'color: #C2995D; font-size: 40px');
console.log('%cMade By Daniel K.', 'color: #C2995D; font-size: 30px');
console.log('%cIf you are snooping around my code, I encourage it! If you find anything off and wish to contribute to this project, please upload a pull request onto my PUBLIC GitHub repository. Yes, Wanshot is open source!', 'color: #C2995D; font-size: 15px');
//EXTRA SCRIPTS//
//UNBIND CONTEXT MENU//
$("html").bind('contextmenu', () => {
return false;
});
//credit to https://stackoverflow.com/questions/21646738/convert-hex-to-rgba
function hexToRgbA(hex, opacity){
var c;
if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)){
c= hex.substring(1).split('');
if(c.length== 3){
c= [c[0], c[0], c[1], c[1], c[2], c[2]];
}
c= '0x'+c.join('');
return 'rgba('+[(c>>16)&255, (c>>8)&255, c&255].join(',')+',' + opacity + ')';
}
throw new Error(`Bad Hex: ${hex}`);
}
</script>
<script src = "js/math-mechanics.js"></script>
<script src = "js/sat.js"></script>
</head>
<body>
<div id = "game-container">
<div class = "outer-wrapper">
<canvas id = "game"></canvas>
</div>
<div class = "outer-wrapper">
<div id = "footer-wrapper">
<div class = "clickable footer-widget" id = "level-editor">
<img class = "img" src = "icons/editor.png">
</div>
<label class = "clickable footer-widget" for = "upload" id = "upload-display">
<img class = "img" src = "icons/upload.png">
</label>
<input type = "file" name = "upload" id = "upload">
</div>
</div>
</div>
<div class = "widget" id = "website-widget">
<img class = "img" src = "https://dkeree.github.io/DkeRee/img/pfp.png">
<script>
const website = document.getElementById("website-widget");
website.addEventListener("click", () => {
playSound(uiClick);
window.open("https://dkeree.github.io/DkeRee/", "_blank");
});
</script>
</div>
<div class = "widget" id = "github-widget">
<img class = "img" src = "icons/github-icon.png">
<script>
const repo = document.getElementById("github-widget");
repo.addEventListener("click", () => {
playSound(uiClick);
window.open("https://github.com/DkeRee/Wanshot", "_blank");
});
</script>
</div>
<div class = "widget" id = "gear-widget">
<img class = "img" src = "icons/gear.png">
</div>
<button id = "credits">CREDITS</button>
<div id = "info-div">
<div id = "close-div">
<button id = "close">X</button>
</div>
<div id = "settings">
<h1 id = "title">Settings</h1>
<h1 class = "settings-text">
Volume:
<input type = "range" min = "0" max = "1" value = "1" class = "range-bar" step = "0.01" id = "volume-bar">
</h1>
<h1 class = "settings-text">
Classic WASD:
<label class = "switch">
<input id = "wasd-toggle" class = "toggle" type = "checkbox">
<span class = "slider"></span>
</label>
</h1>
<h1 class = "settings-text">
Exhaust:
<label class = "switch">
<input id = "exhaust-toggle" class = "toggle" type = "checkbox">
<span class = "slider"></span>
</label>
</h1>
<h1 class = "settings-text">
???:
<label class = "switch">
<input id = "rgb-toggle" class = "toggle" type = "checkbox">
<span class = "slider"></span>
</label>
</h1>
</div>
<iframe id = "iframe" src = "popup/credit.html"></iframe>
</div>
<!--JS SCRIPTS-->
<script>
//GLOBAL CANVAS CONSTANTS//
const html = document.querySelector("html");
const canvas = document.getElementById("game");
const ctx = canvas.getContext("2d");
</script>
<script src = "js/loadingArt.js"></script>
<script src = "js/intermission.js"></script>
<script src = "js/pause.js"></script>
<script src = "js/globals.js"></script>
<script src = "js/introPack/text.js"></script>
<script src = "js/introPack/intro.js"></script>
<script src = "js/confetti.js"></script>
<script src = "js/portal.js"></script>
<script src = "js/tile.js"></script>
<script src = "js/mine.js"></script>
<script src = "js/shell.js"></script>
<script src = "js/tank.js"></script>
<script src = "js/cast-library.js"></script>
<script src = "js/bot.js"></script>
<script src = "js/tankTypes/player.js"></script>
<script src = "js/tankTypes/brown.js"></script>
<script src = "js/tankTypes/grey.js"></script>
<script src = "js/tankTypes/yellow.js"></script>
<script src = "js/tankTypes/pink.js"></script>
<script src = "js/tankTypes/teal.js"></script>
<script src = "js/tankTypes/purple.js"></script>
<script src = "js/tankTypes/white.js"></script>
<script src = "js/tankTypes/green.js"></script>
<script src = "js/tankTypes/black.js"></script>
<script src = "js/tankTypes/orange.js"></script>
<script src = "js/tankTypes/blurple.js"></script>
<script src = "js/tankTypes/violet.js"></script>
<script src = "js/tankTypes/tan.js"></script>
<script src = "js/campaign.js"></script>
<script src = "js/levelCloner.js"></script>
<script src = "js/settings.js"></script>
<script src = "js/customLoader.js"></script>
<script src = "js/runner.js"></script>
<script>
const creditButton = document.getElementById("credits");
const settingButton = document.getElementById("gear-widget");
const closeButton = document.getElementById("close");
const editorButton = document.getElementById("level-editor");
const uploadButton = document.getElementById("upload");
const infoDiv = document.getElementById("info-div");
const iframe = document.getElementById("iframe");
const settings = document.getElementById("settings");
creditButton.addEventListener("click", e => {
//create ripple for decor
const html = document.querySelector("html");
const ripple = document.createElement("span");
const rect = creditButton.getBoundingClientRect();
var scale;
if (window.getComputedStyle(html).zoom > 1) {
scale = 1;
} else {
scale = window.getComputedStyle(html).zoom;
}
ripple.setAttribute("class", "ripple");
ripple.style.left = `${e.clientX / scale - rect.x}px`;
ripple.style.top = `${e.clientY / scale - rect.y}px`;
creditButton.prepend(ripple);
setTimeout(() => {
ripple.remove();
}, 1000);
playSound(uiClick);
//do something bruh
iframe.style.display = "block";
settings.style.display = "none";
infoDiv.style.display = "block";
});
editorButton.addEventListener("click", () => {
playSound(uiClick);
window.open("level_creator/index.html", "_target");
});
uploadButton.addEventListener("click", () => {
playSound(uiClick);
});
uploadButton.addEventListener("change", () => {
//filter out bad requests
if (uploadButton.files.length == 1) {
fileReader.readAsText(uploadButton.files[0]);
}
});
settingButton.addEventListener("click", () => {
playSound(uiClick);
iframe.style.display = "none";
settings.style.display = "block";
infoDiv.style.display = "block";
});
closeButton.addEventListener("click", () => {
playSound(uiClick);
//aksjdghx
iframe.style.display = "none";
settings.style.display = "none";
infoDiv.style.display = "none";
});
</script>
</body>
</html>