-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.html
More file actions
179 lines (160 loc) · 5.86 KB
/
Copy pathdebug.html
File metadata and controls
179 lines (160 loc) · 5.86 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hill Climb Racing Clone - Debug Mode</title>
<style>
body {
margin: 0;
padding: 0;
background: linear-gradient(to bottom, #87CEEB, #98FB98);
font-family: Arial, sans-serif;
overflow: hidden;
height: 100vh;
display: flex;
flex-direction: column;
}
#levelText {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
color: white;
text-align: center;
font-size: 24px;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
background: rgba(0, 0, 0, 0.1);
min-height: 200px;
}
#gameContainer {
position: relative;
flex-shrink: 0;
}
#gameCanvas {
display: block;
margin: 0 auto;
border: 2px solid #333;
background: linear-gradient(to bottom, #87CEEB 0%, #87CEEB 60%, #90EE90 60%, #228B22 100%);
}
#ui {
position: absolute;
top: 10px;
left: 10px;
color: white;
font-size: 18px;
text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
z-index: 10;
}
#debug {
position: absolute;
top: 10px;
right: 10px;
color: white;
font-size: 14px;
text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
background: rgba(0,0,0,0.3);
padding: 10px;
border-radius: 5px;
z-index: 10;
}
#controls {
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
color: white;
text-align: center;
font-size: 14px;
z-index: 10;
}
#console {
position: absolute;
bottom: 60px;
left: 10px;
right: 10px;
height: 100px;
background: rgba(0,0,0,0.8);
color: #00ff00;
font-family: monospace;
font-size: 12px;
padding: 10px;
overflow-y: auto;
border-radius: 5px;
}
</style>
</head>
<body>
<div id="levelText">
<div id="levelContent">
<!-- Level-specific text will be displayed here -->
Sveiki atvykę į Bernvakario Nuotykius! (Debug Mode)
</div>
</div>
<div id="gameContainer">
<canvas id="gameCanvas" width="1200" height="600"></canvas>
<div id="ui">
<div>Level: <span id="level">1</span></div>
<div>Score: <span id="score">0</span></div>
<div>Fuel: <span id="fuel">100</span>%</div>
<div>Speed: <span id="speed">0</span> km/h</div>
<div style="margin-top: 10px;">
<label for="volumeSlider">🔊 Volume: </label>
<input type="range" id="volumeSlider" min="0" max="100" value="50" style="width: 80px;">
<span id="volumeValue">50%</span>
</div>
</div>
<div id="debug">
<div>DEBUG MODE</div>
<div>Vehicle X: <span id="vehicleX">0</span></div>
<div>Vehicle Y: <span id="vehicleY">0</span></div>
<div>Angle: <span id="vehicleAngle">0</span>°</div>
<div>Collectibles: <span id="collectibleCount">0</span></div>
</div>
<div id="console"></div>
<div id="controls">
<div>Arrow Keys: Accelerate/Brake | Space: Restart | F12: Open DevTools</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/matter-js/0.19.0/matter.min.js"></script>
<script>
// Override console.log to show in our debug console
const originalLog = console.log;
const originalError = console.error;
const debugConsole = document.getElementById('console');
function addToDebugConsole(message, type = 'log') {
const div = document.createElement('div');
div.style.color = type === 'error' ? '#ff0000' : '#00ff00';
div.textContent = `[${new Date().toLocaleTimeString()}] ${message}`;
debugConsole.appendChild(div);
debugConsole.scrollTop = debugConsole.scrollHeight;
}
console.log = function(...args) {
originalLog.apply(console, args);
addToDebugConsole(args.join(' '), 'log');
};
console.error = function(...args) {
originalError.apply(console, args);
addToDebugConsole(args.join(' '), 'error');
};
console.log('Debug mode initialized');
</script>
<script src="game.js"></script>
<script>
// Add debug info updates
const originalUpdateUI = HillClimbGame.prototype.updateUI;
HillClimbGame.prototype.updateUI = function() {
originalUpdateUI.call(this);
// Update debug info
if (this.vehicleBody && this.vehicleBody.position) {
document.getElementById('vehicleX').textContent = Math.floor(this.vehicleBody.position.x);
document.getElementById('vehicleY').textContent = Math.floor(this.vehicleBody.position.y);
document.getElementById('vehicleAngle').textContent = Math.floor(this.vehicleBody.angle * 180 / Math.PI);
}
const uncollected = this.collectibles.filter(c => !c.collected).length;
document.getElementById('collectibleCount').textContent = uncollected;
};
</script>
</body>
</html>