-
Notifications
You must be signed in to change notification settings - Fork 2
/
VOID.html
267 lines (227 loc) · 9.26 KB
/
VOID.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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="icon" href="voidicon.png" type="image/png">
<audio src="mary.mp3" autoplay loop></audio>
<audio id="boys-audio" src="boys.mp3" loop></audio>
<script>
document.addEventListener('DOMContentLoaded', () => {
let inputBuffer = '';
const targetKeyword = 'gay';
const audioElement = document.getElementById('boys-audio');
function playAudio() {
document.querySelectorAll('audio').forEach(audio => {
if (audio !== audioElement) {
audio.pause();
audio.currentTime = 0;
}
});
audioElement.play();
audioElement.loop = true;
}
document.addEventListener('keydown', (event) => {
inputBuffer += event.key.toLowerCase();
if (inputBuffer.length > targetKeyword.length) {
inputBuffer = inputBuffer.slice(-targetKeyword.length);
}
if (inputBuffer === targetKeyword) {
playAudio();
}
});
});
</script>
<audio id="boys-audio" src="boys.mp3" loop></audio>
<meta property="og:title" content="VOID">
<meta property="og:description" content="A 3D web experience by Tacoguy21">
<meta property="og:image" content="Spaceship.png">
<meta property="og:url" content="https://tacovoidgame.netlify.app/">
<link rel="icon" href="voidlogo.png" type="image/png">
<style>
p {
font-family: 'Space Mono', monospace;
}
h2 {
font-family: 'Space Mono', monospace;
}
.fake-popup {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 200px;
padding: 10px;
background-color: rgb(50, 50, 50);
color: rgb(200, 200, 200);
border: 7px solid rgb(80, 0, 0);
border-radius: 5px;
text-align: center;
display: none;
}
.close-btn {
position: absolute;
top: 5px;
right: 5px;
cursor: pointer;
color: rgb(255, 100, 100);
}
</style>
</head>
<body>
<div class="fake-popup" id="popup">
<span class="close-btn" onclick="hidePopup()">X</span>
<h2>Important Message</h2>
<p>You are the grey cube</p>
<p>Avoid the spikes and get to the green thing</p>
<p>You have 0.5 seconds of invincibility at the beginning of each stage</p>
<p>(There are 13 stages)</p>
<p>Use your invincibility wisely</p>
<p>Arrows or WASD to move</p>
<p>When dead click the red text to revive</p>
<p>Remember to think outside the box</p>
<p>You may close.</p>
</div>
<script>
function showPopup() {
var popup = document.getElementById('popup');
var bodyRect = document.body.getBoundingClientRect();
var popupRect = popup.getBoundingClientRect();
var leftPos = bodyRect.width / 2 + (Math.random() - 0.5) * (bodyRect.width / 4);
var topPos = bodyRect.height / 2 + (Math.random() - 0.5) * (bodyRect.height / 4);
popup.style.left = leftPos + 'px';
popup.style.top = topPos + 'px';
popup.style.display = 'block';
}
function hidePopup() {
var popup = document.getElementById('popup');
popup.style.display = 'none';
}
window.onload = showPopup;
</script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>VOID</title>
<style>
body {
margin: 0;
overflow: hidden;
font-family: monospace, serif;
background: #000000;
color: #fff;
}
#message {
display: none;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 48px;
color: rgb(255, 50, 50);
}
#completeMessage {
display: none;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 48px;
color: rgb(100, 100, 255);
}
</style>
</head>
<body>
<div id="message" style="cursor: pointer;" onclick="location.reload();">failed.</div>
<div id="completeMessage">complete.</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script>
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x000000);
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.set(0, 1, 5);
const renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
const light = new THREE.DirectionalLight(0xffffff, 1);
light.position.set(0, 1, 1).normalize();
scene.add(light);
const playerGeometry = new THREE.BoxGeometry(0.5, 0.5, 0.5);
const playerMaterial = new THREE.MeshPhongMaterial({ color: 0xbbbbbb });
const player = new THREE.Mesh(playerGeometry, playerMaterial);
scene.add(player);
const targetGeometry = new THREE.BoxGeometry(0.5, 0.5, 0.5);
const targetMaterial = new THREE.MeshPhongMaterial({ color: 0x66ff66 });
const target = new THREE.Mesh(targetGeometry, targetMaterial);
target.position.set(0, 0.25, -2.5);
scene.add(target);
let spikes = [];
let level = 1;
const maxLevel = 15;
function isValidSpikePosition(position) {
const distanceToPlayer = player.position.distanceTo(position);
return distanceToPlayer > 1.0;
}
let invincible = false;
let invincibleTimeout = null;
function resetLevel() {
spikes.forEach(spike => scene.remove(spike));
spikes = [];
const spikeCount = 1 + (level - 1) * 1;
for (let i = 0; i < spikeCount; i++) {
let spikePosition;
do {
spikePosition = new THREE.Vector3(Math.random() * 6 - 3, 0.5, Math.random() * 6 - 3);
} while (!isValidSpikePosition(spikePosition));
const spikeGeometry = new THREE.ConeGeometry(0.2, 1, 32);
const spikeMaterial = new THREE.MeshPhongMaterial({ color: 0xAE4305});
const spike = new THREE.Mesh(spikeGeometry, spikeMaterial);
spike.position.copy(spikePosition);
spike.rotation.x = 0;
spikes.push(spike);
scene.add(spike);
}
player.position.set(Math.random() * 6 - 3, 0.25, Math.random() * 6 - 3);
invincible = true;
invincibleTimeout = setTimeout(() => {
invincible = false;
}, 500);
}
resetLevel();
const speed = 0.07;
const keys = { ArrowUp: false, ArrowDown: false, ArrowLeft: false, ArrowRight: false, KeyW: false, KeyS: false, KeyA: false, KeyD: false };
document.addEventListener('keydown', (e) => keys[e.code] = true);
document.addEventListener('keyup', (e) => keys[e.code] = false);
function movePlayer() {
if (keys.ArrowUp || keys.KeyW) player.position.z -= speed;
if (keys.ArrowDown || keys.KeyS) player.position.z += speed;
if (keys.ArrowLeft || keys.KeyA) player.position.x -= speed;
if (keys.ArrowRight || keys.KeyD) player.position.x += speed;
}
function animate() {
requestAnimationFrame(animate);
movePlayer();
spikes.forEach(spike => {
const distance = player.position.distanceTo(spike.position);
if (distance < 0.5 && !invincible) {
document.getElementById('message').style.display = 'block';
renderer.domElement.style.display = 'none';
}
});
if (player.position.distanceTo(target.position) < 0.5) {
level++;
if (level > maxLevel) {
document.getElementById('completeMessage').style.display = 'block';
renderer.domElement.style.display = 'none';
} else {
resetLevel();
}
}
renderer.render(scene, camera);
}
animate();
window.addEventListener('resize', () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
</script>
</body>
</html>