-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreplindex.html
More file actions
655 lines (583 loc) Β· 25.7 KB
/
replindex.html
File metadata and controls
655 lines (583 loc) Β· 25.7 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
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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="mobile-web-app-capable" content="yes">
<title>Slope Game</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
margin: 0;
background: #231F20;
color: white;
font-family: Arial, sans-serif;
overflow: hidden;
touch-action: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.webgl-content {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#gameContainer {
width: 100vw;
height: 100vh;
max-width: 100%;
max-height: 100%;
}
#gameContainer canvas {
width: 100% !important;
height: 100% !important;
display: block;
touch-action: none; /* Prevent browser touch handling */
}
/* Progress bar styling */
.webgl-content .logo, .progress {
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.webgl-content .logo {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJoAAACCCAQAAAAUcxlqAAAFi0lEQVR42u2d7bWkIAyGtwRLsARKoARLsARLoANLsARLsARLsARLYJ3Z2TneczUECOFD4s/1zsx5FpI3JMAf/ac+tk9F4A6tPNNCD3rWWg/AOxXaB0Srez3pTf+3pUK7B9DoTo961b+sQrueiEov+t5khXaeiC+vtWuTjRXaayL+9FomWx8NTctrr2W05oHQ3vJh0e7WPwjaWz5gvJbJpgdA+8iHTVPZVjS0w2spJ69lsrZAaN+kJ5QNBUH7lfSEsrkYaEHH1k/bC4F2OHtOEwVAOyLkxgpNlQBNaV5bsod2BIBdc1uTO7SJwrlbvt9lDe2QsH6w5kPViUOs2NmYN7TFB9Y3kNiOtDVjaNYj5HDiR9gQBIGkzRSaldR4wZI3gYRgiSgfaMoHlmcuMWUJzSA11mNBSAYMJHue0OZbWN3dovTFp0CLRzM4/UWC0A4nv1w+KwUsVCBpQQ04JAcNHRc3F1goqaEMCwFzYtBQyPbjrdbrW0bwP6N5YwUsKWjIUSa8AwlCUoA+TyYDDYmsD5pLLChZoxKBxoYMlhoS9d6aBDQuZMc3bVjhCgaLJjo0RmQDGGAadMbQRYbGiMwoNdC/a4oKjQ+ZSWpYRdktIjRWZK3dmqzB/7WRoHEiw0oN9Mjso0BjRiYd+jQQyRQrNF5khql23xxqXCJihIZENpEhs5Aa6CktWKGxI4OlxuAIWzFC40ZmqJCu4F8KU/BggRYBmcBlm/a+kAkaPzKDX5q9RmnHAC0Ksg4MAa3Xbx6DQ4uBzCA1FCqIgP4wKLRIyJRpYduzbtUEhBYJGSw1kMIZTqaCQYuDzODEF5IETAWChkS2kiMTVOUZYLy2QaBhkblVMJ2lhtWovl3DVUECQURknVu2aZFM/auQUkOLiKzxlRqI5cs+QEYQD5lJapCovSXA0lBUZHAzliSpLghyaOg2lvWmQ8jv2SikBughR/LCikNHLJ+1jj7yJpAQQUsa2UgiYAbitoSkke3uHvQUWlbiVqukkXmVaU75hSSFljgyz0TtE5Fpu7sd+/KzGGenZKojhVb8SFuvJEv1abhUqieGVnD07K8/5Qk6TXl6tF9qr2YE+IVIEaA/rbjcU9x2gRe0yuFRU0cuNYXpT4uKzapR1Gnp/BMOYq3czgGgOfcJWRSMQ3UNxSreGb7ZtkbQ3QeVmNWoENhWqiWi2/rpEqwtIVqpWJLVPe+jcVdehX0mqbC3ESrsEXs5rHcOWLeQysd1DXmP173I/jSKojEslsrshPSUHmA4GZ7Zc2v8JjC3aMvt7vaSHoDa2wJlBB7YFCE25+Y+MP5OjNAi7ItybiMFf2nHCi0CNseGZXCMNszQEtuFpxwaR9cg62lpYXPZhAF27aoo0JLaWTxZT2oZCRrzHnbrjWUA5j1IjSBJbKON9AA3+MxRoSV0Lkdv4QWHyNCSPQFmxFRP61lDCvnmFqDCHhCb9IaGPGrCnEAlAA19Sp8IKj1m1ETukoHGhQ1XfwfrC01C0NDYOs9vUebWP3MClQw0i9YZ44nJPtID3uOZHDTgnNvr026d4JkWwUG5IROE5ujILeHB9XfgXzM9hlpSTFvns7vnLKEhLwoxnxI/OUEbcoVms2MBuo/A5WKbNlNoTndWXMBz+JTfJ0dmBK1xvv7oBM/hsq4pY2gEHeRveNafkvcVSAbREMqyv2xLsiO72F2V3114S/z9LvlB494sKQuAZliSJt+OdvkLMoTWMN68WM71u+96pmLxbiVd9HwquY1BZUhbILTvhA1zV3bZl9d/I+vrVnY6jzc9ANpJAtN4vO5B0L6T1tfjNY+Ddpq0bh7v9niKB0A7yRQ7j6cqNHuPJys0W4+3A3/7VGhGjzdXaPYeb6jQ7DzeqsEDUHyPAqtPhVahJff8BbhPqVERIfSQAAAAAElFTkSuQmCC') no-repeat center / contain;
width: 154px;
height: 130px;
}
.webgl-content .progress {
height: 18px;
width: 141px;
margin-top: 90px;
}
.webgl-content .progress .empty {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAI0AAAASCAQAAADMZ5W4AAAAOUlEQVRYw+3YsQkAQAwDMe+/dL4PJPCQUucNVDqloSDYaWJtaNCgQYMGDRo0aNCgQYEGzSWN/DU/Pd/qSl+UowXtAAAAAElFTkSuQmCC') no-repeat right / cover;
float: right;
width: 100%;
height: 100%;
display: inline-block;
}
.webgl-content .progress .full {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAI0AAAASCAAAAABDBQLvAAAAJElEQVR42mP4P5gAw6hrRl0z6ppR14y6ZtQ1o64Zdc2oa2gIAJtx4J4m8q7hAAAAAElFTkSuQmCC') no-repeat left / cover;
float: left;
width: 0%;
height: 100%;
display: inline-block;
}
/* Fullscreen button styling */
.fullscreen-btn {
position: fixed;
bottom: 20px;
right: 140px;
width: 48px;
height: 48px;
background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjQ4IiBoZWlnaHQ9IjQ4IiByeD0iOCIgZmlsbD0iIzAwMDAwMCIgZmlsbC1vcGFjaXR5PSIwLjYiLz4KPHBhdGggZD0iTTE0IDE0SDIwVjE2SDE2VjIwSDE0VjE0Wk0yOCAxNEgzNFYyMEgzMlYxNkgyOFYxNFpNMzIgMjhIMzRWMzRIMjhWMzJIMzJWMjhaTTE2IDI4SDIwVjMySDE2VjI4Wk0xNCAyOFYzNEgyMFYzMkgxNlYyOEgxNFoiIGZpbGw9IiNGRkZGRkYiLz4KPHN2Zz4K');
background-size: contain;
background-repeat: no-repeat;
background-position: center;
cursor: pointer;
z-index: 2000;
opacity: 0.8;
transition: opacity 0.3s ease;
pointer-events: auto;
}
.fullscreen-btn:hover {
opacity: 1;
}
/* Control buttons - Mobile optimized */
.control-btn {
position: fixed;
bottom: 20px;
width: 100px;
height: 100px;
background-color: rgba(255, 255, 255, 0.5);
border: 3px solid rgba(255, 255, 255, 1.0);
border-radius: 20px;
display: flex;
align-items: center;
justify-content: center;
font-size: 32px;
font-weight: bold;
color: #231F20;
cursor: pointer;
user-select: none;
z-index: 2000;
transition: all 0.1s ease;
-webkit-tap-highlight-color: transparent;
touch-action: manipulation;
pointer-events: auto;
}
.control-btn:hover {
background-color: rgba(255, 255, 255, 0.7);
transform: scale(1.05);
}
.control-btn:active,
.control-btn.pressed {
background-color: rgba(255, 255, 255, 0.9);
transform: scale(0.95);
}
.left-btn {
left: 20px;
}
.right-btn {
right: 20px;
}
/* Mobile-specific adjustments */
@media (max-width: 768px) {
.control-btn {
width: 80px;
height: 80px;
font-size: 28px;
bottom: 10px;
}
.left-btn {
left: 10px;
}
.right-btn {
right: 10px;
}
.fullscreen-btn {
bottom: 10px;
right: 100px;
width: 40px;
height: 40px;
}
}
@media (max-width: 480px) {
.control-btn {
width: 70px;
height: 70px;
font-size: 24px;
}
.fullscreen-btn {
right: 85px;
width: 35px;
height: 35px;
}
}
.error-msg {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: rgba(255, 0, 0, 0.8);
color: white;
padding: 20px;
border-radius: 10px;
text-align: center;
max-width: 90%;
z-index: 9999;
}
/* Updated touch zones */
.touch-zone {
position: fixed;
top: 0;
height: 100%;
background: transparent;
border: none;
cursor: pointer;
z-index: 1500;
pointer-events: none;
opacity: 0;
}
.touch-zone.active {
pointer-events: auto;
}
</style>
<script src="TemplateData/UnityProgress.js"></script>
<script src="TemplateData/unityloader41.js"></script>
<script>
// Mobile-optimized control functionality
let isLeftPressed = false;
let isRightPressed = false;
let gameCanvas = null;
let resizeObserver = null;
let visualViewport = null;
function simulateKeyPress(keyCode) {
const event = new KeyboardEvent('keydown', {
key: keyCode === 65 ? 'a' : 'd',
keyCode: keyCode,
which: keyCode,
bubbles: true,
cancelable: true
});
document.dispatchEvent(event);
}
function simulateKeyRelease(keyCode) {
const event = new KeyboardEvent('keyup', {
key: keyCode === 65 ? 'a' : 'd',
keyCode: keyCode,
which: keyCode,
bubbles: true,
cancelable: true
});
document.dispatchEvent(event);
}
// Enhanced mobile touch handling
function handleButtonPress(button, keyCode, isPressed) {
if (keyCode === 65) { // Left button
if (isPressed && !isLeftPressed) {
isLeftPressed = true;
button.classList.add('pressed');
simulateKeyPress(keyCode);
} else if (!isPressed && isLeftPressed) {
isLeftPressed = false;
button.classList.remove('pressed');
simulateKeyRelease(keyCode);
}
} else { // Right button
if (isPressed && !isRightPressed) {
isRightPressed = true;
button.classList.add('pressed');
simulateKeyPress(keyCode);
} else if (!isPressed && isRightPressed) {
isRightPressed = false;
button.classList.remove('pressed');
simulateKeyRelease(keyCode);
}
}
}
// Screen half controls for mobile
let useScreenHalves = false;
let screenLeftPressed = false;
let screenRightPressed = false;
function handleLeftHalfTouch(isPressed) {
if (isPressed && !screenLeftPressed) {
screenLeftPressed = true;
simulateKeyPress(65); // A key
} else if (!isPressed && screenLeftPressed) {
screenLeftPressed = false;
simulateKeyRelease(65);
}
}
function handleRightHalfTouch(isPressed) {
if (isPressed && !screenRightPressed) {
screenRightPressed = true;
simulateKeyPress(68); // D key
} else if (!isPressed && screenRightPressed) {
screenRightPressed = false;
simulateKeyRelease(68);
}
}
function toggleScreenHalves() {
useScreenHalves = !useScreenHalves;
const leftHalfBtn = document.getElementById('leftHalfBtn');
const rightHalfBtn = document.getElementById('rightHalfBtn');
if (useScreenHalves) {
leftHalfBtn.classList.add('active');
rightHalfBtn.classList.add('active');
} else {
leftHalfBtn.classList.remove('active');
rightHalfBtn.classList.remove('active');
// Release any active screen touches
if (screenLeftPressed) {
screenLeftPressed = false;
simulateKeyRelease(65);
}
if (screenRightPressed) {
screenRightPressed = false;
simulateKeyRelease(68);
}
}
}
// Enhanced resize function with touch zone updates
function resizeGame() {
const container = document.getElementById("gameContainer");
const canvas = container.querySelector("canvas");
if (canvas) {
gameCanvas = canvas;
canvas.style.width = "100vw";
canvas.style.height = "100vh";
updateTouchZones();
}
}
// Update touch zones to match canvas position
function updateTouchZones() {
if (!gameCanvas) return;
const rect = gameCanvas.getBoundingClientRect();
const leftHalfBtn = document.getElementById('leftHalfBtn');
const rightHalfBtn = document.getElementById('rightHalfBtn');
if (leftHalfBtn && rightHalfBtn) {
leftHalfBtn.style.width = `${rect.width/2}px`;
leftHalfBtn.style.height = `${rect.height}px`;
leftHalfBtn.style.left = `${rect.left}px`;
leftHalfBtn.style.top = `${rect.top}px`;
rightHalfBtn.style.width = `${rect.width/2}px`;
rightHalfBtn.style.height = `${rect.height}px`;
rightHalfBtn.style.left = `${rect.left + rect.width/2}px`;
rightHalfBtn.style.top = `${rect.top}px`;
}
}
// Handle iOS viewport scaling
function setupVisualViewport() {
if (!window.visualViewport) return;
visualViewport = window.visualViewport;
const update = () => {
resizeGame();
// Prevent content shifting on iOS
document.documentElement.style.height = `${visualViewport.height}px`;
window.scrollTo(0, 0);
};
visualViewport.addEventListener('resize', update);
visualViewport.addEventListener('scroll', update);
}
// Initialize game with mobile compatibility settings
const gameInstance = UnityLoader.instantiate("gameContainer", "Build/slope.json", {
onProgress: UnityProgress,
Module: {
onRuntimeInitialized: function() {
UnityProgress(gameInstance, "complete");
resizeGame();
setupVisualViewport();
// Hide Unity mobile warning if it appears
setTimeout(function() {
const unityWarnings = document.querySelectorAll('[style*="position: absolute"], [style*="position:absolute"]');
unityWarnings.forEach(function(warning) {
if (warning.textContent && warning.textContent.includes('mobile')) {
warning.style.display = 'none';
}
});
}, 2000);
}
},
compatibilityCheck: function(unityInstance, onsuccess, onerror) {
// Always succeed to bypass Unity's mobile compatibility check
onsuccess();
}
});
window.addEventListener('resize', resizeGame);
window.addEventListener('load', resizeGame);
// Prevent mobile browser zoom
document.addEventListener('gesturestart', function(e) {
e.preventDefault();
});
document.addEventListener('gesturechange', function(e) {
e.preventDefault();
});
document.addEventListener('gestureend', function(e) {
e.preventDefault();
});
// Setup enhanced mobile control buttons
document.addEventListener('DOMContentLoaded', function() {
const leftBtn = document.getElementById('leftBtn');
const rightBtn = document.getElementById('rightBtn');
if (leftBtn) {
// Mouse events
leftBtn.addEventListener('mousedown', function(e) {
e.preventDefault();
e.stopPropagation();
handleButtonPress(leftBtn, 65, true);
});
leftBtn.addEventListener('mouseup', function(e) {
e.preventDefault();
e.stopPropagation();
handleButtonPress(leftBtn, 65, false);
});
leftBtn.addEventListener('mouseleave', function(e) {
handleButtonPress(leftBtn, 65, false);
});
// Touch events
leftBtn.addEventListener('touchstart', function(e) {
e.preventDefault();
e.stopPropagation();
handleButtonPress(leftBtn, 65, true);
});
leftBtn.addEventListener('touchend', function(e) {
e.preventDefault();
e.stopPropagation();
handleButtonPress(leftBtn, 65, false);
});
leftBtn.addEventListener('touchcancel', function(e) {
e.preventDefault();
e.stopPropagation();
handleButtonPress(leftBtn, 65, false);
});
}
if (rightBtn) {
// Mouse events
rightBtn.addEventListener('mousedown', function(e) {
e.preventDefault();
e.stopPropagation();
handleButtonPress(rightBtn, 68, true);
});
rightBtn.addEventListener('mouseup', function(e) {
e.preventDefault();
e.stopPropagation();
handleButtonPress(rightBtn, 68, false);
});
rightBtn.addEventListener('mouseleave', function(e) {
handleButtonPress(rightBtn, 68, false);
});
// Touch events
rightBtn.addEventListener('touchstart', function(e) {
e.preventDefault();
e.stopPropagation();
handleButtonPress(rightBtn, 68, true);
});
rightBtn.addEventListener('touchend', function(e) {
e.preventDefault();
e.stopPropagation();
handleButtonPress(rightBtn, 68, false);
});
rightBtn.addEventListener('touchcancel', function(e) {
e.preventDefault();
e.stopPropagation();
handleButtonPress(rightBtn, 68, false);
});
}
// Create dynamic touch zones
const leftHalfBtn = document.createElement('div');
leftHalfBtn.id = 'leftHalfBtn';
leftHalfBtn.className = 'touch-zone';
const rightHalfBtn = document.createElement('div');
rightHalfBtn.id = 'rightHalfBtn';
rightHalfBtn.className = 'touch-zone';
// Add event listeners to touch zones
// Left half button events
leftHalfBtn.addEventListener('mousedown', function(e) {
e.preventDefault();
e.stopPropagation();
handleLeftHalfTouch(true);
});
leftHalfBtn.addEventListener('mouseup', function(e) {
e.preventDefault();
e.stopPropagation();
handleLeftHalfTouch(false);
});
leftHalfBtn.addEventListener('mouseleave', function(e) {
handleLeftHalfTouch(false);
});
leftHalfBtn.addEventListener('touchstart', function(e) {
e.preventDefault();
e.stopPropagation();
handleLeftHalfTouch(true);
});
leftHalfBtn.addEventListener('touchend', function(e) {
e.preventDefault();
e.stopPropagation();
handleLeftHalfTouch(false);
});
leftHalfBtn.addEventListener('touchcancel', function(e) {
e.preventDefault();
e.stopPropagation();
handleLeftHalfTouch(false);
});
// Right half button events
rightHalfBtn.addEventListener('mousedown', function(e) {
e.preventDefault();
e.stopPropagation();
handleRightHalfTouch(true);
});
rightHalfBtn.addEventListener('mouseup', function(e) {
e.preventDefault();
e.stopPropagation();
handleRightHalfTouch(false);
});
rightHalfBtn.addEventListener('mouseleave', function(e) {
handleRightHalfTouch(false);
});
rightHalfBtn.addEventListener('touchstart', function(e) {
e.preventDefault();
e.stopPropagation();
handleRightHalfTouch(true);
});
rightHalfBtn.addEventListener('touchend', function(e) {
e.preventDefault();
e.stopPropagation();
handleRightHalfTouch(false);
});
rightHalfBtn.addEventListener('touchcancel', function(e) {
e.preventDefault();
e.stopPropagation();
handleRightHalfTouch(false);
});
// Add touch zones to page
document.body.appendChild(leftHalfBtn);
document.body.appendChild(rightHalfBtn);
// Add screen halves toggle button
const toggleBtn = document.createElement('div');
toggleBtn.innerHTML = 'π';
toggleBtn.style.cssText = 'position: fixed; top: 20px; right: 20px; width: 40px; height: 40px; background: rgba(255,255,255,0.5); border: 2px solid rgba(255,255,255,1); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; cursor: pointer; z-index: 2001; transition: all 0.3s ease; pointer-events: auto;';
toggleBtn.title = 'Toggle screen half controls';
toggleBtn.addEventListener('click', function(e) {
e.preventDefault();
e.stopPropagation();
toggleScreenHalves();
toggleBtn.style.background = useScreenHalves ? 'rgba(0,255,0,0.5)' : 'rgba(255,255,255,0.5)';
});
document.body.appendChild(toggleBtn);
// Create ResizeObserver to detect layout changes
resizeObserver = new ResizeObserver(() => {
updateTouchZones();
});
// Start observing document changes
resizeObserver.observe(document.documentElement);
});
</script>
</head>
<body style="margin: 0; overflow: hidden; background: #231F20;">
<div class="webgl-content">
<div id="gameContainer"></div>
<div class="fullscreen-btn" onclick="gameInstance && gameInstance.SetFullscreen(1)"></div>
<div class="control-btn left-btn" id="leftBtn">A</div>
<div class="control-btn right-btn" id="rightBtn">D</div>
<div id="errorMsg" class="error-msg" style="display: none;"></div>
</div>
<!--
MOBILE-COMPATIBLE SLOPE GAME HTML FILE
This file contains all the necessary HTML, CSS, and JavaScript to run the Slope Game
with full mobile compatibility and touch controls.
REQUIREMENTS:
- This HTML file must be placed in the same directory as the "Build" folder
- The Build folder should contain: slope_data.unityweb, slope_wasmcode.unityweb, slope_wasmframework.unityweb
MOBILE FEATURES:
β Responsive design that adapts to any screen size
β Enhanced touch controls (A/D buttons) optimized for mobile
β Screen half controls (optional) - left half = left, right half = right
β Mobile-specific viewport handling
β Prevention of unwanted zoom/gestures
β Visual feedback for touch interactions
β Optimized button sizes for different screen sizes
β PWA-ready meta tags for mobile browsers
β Handles mobile keyboard appearance/disappearance
DESKTOP FEATURES:
β Keyboard controls (A/D or Arrow keys)
β Mouse controls on touch buttons
β Fullscreen support
β Clean interface with no ads or external dependencies
MOBILE USAGE:
1. Place this HTML file alongside the Build folder
2. Open in any mobile browser (Chrome, Safari, Firefox, etc.)
3. Use the A/D buttons on screen to control the ball
4. Optional: Tap the π button (top-right) to enable screen half controls
5. Tap fullscreen button for immersive gameplay
DESKTOP USAGE:
1. Place this HTML file alongside the Build folder
2. Open in any modern web browser
3. Use A/D keys, Arrow keys, or click the on-screen buttons
4. Click fullscreen button for immersive gameplay
SCREEN HALF CONTROLS:
- Touch the left half of the screen to move left
- Touch the right half of the screen to move right
- Toggle on/off with the π button in the top-right corner
- Works independently from the A/D buttons
-->
</body>
</html>