-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug-current-game.js
More file actions
84 lines (72 loc) · 2.45 KB
/
debug-current-game.js
File metadata and controls
84 lines (72 loc) · 2.45 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
// Debug your current "Neon Velocity" game
console.log('🔍 Debugging your current racing game...');
// Add this to browser console to inspect your game data
function debugCurrentGame() {
// Try to find the game engine instance
const canvas = document.querySelector('canvas');
if (canvas && canvas.gameEngine) {
const engine = canvas.gameEngine;
console.log('🎮 Found game engine:', engine);
console.log('📊 Game data:', engine.gameData);
console.log('🏎️ Player entity:', engine.player);
console.log('🎯 Entities:', engine.gameData.entities);
if (engine.player) {
console.log('🔧 Player physics:', engine.player.physics);
console.log('⚡ Player velocity:', engine.player.velocity);
console.log('📍 Player position:', { x: engine.player.x, y: engine.player.y });
console.log('🏁 Racing properties:', {
currentSpeed: engine.player.currentSpeed,
steeringAngle: engine.player.steeringAngle,
facingAngle: engine.player.facingAngle
});
}
return engine;
} else {
console.log('❌ Game engine not found on canvas');
return null;
}
}
// Auto-run inspection
setTimeout(() => {
console.log('🚀 Auto-inspecting game...');
debugCurrentGame();
}, 2000);
// Make available globally
if (typeof window !== 'undefined') {
window.debugCurrentGame = debugCurrentGame;
// Also try to fix the game if found
window.quickFixRacing = function() {
const engine = debugCurrentGame();
if (engine && engine.player) {
console.log('🔧 Quick-fixing racing properties...');
// Force racing physics
engine.player.physics = {
...engine.player.physics,
gravity: false,
maxSpeed: 8,
acceleration: 0.5,
braking: 0.7,
turning: 0.3,
drift: 0.1
};
// Force racing properties
engine.player.currentSpeed = 0;
engine.player.steeringAngle = 0;
engine.player.facingAngle = 0;
// Ensure emoji
if (!engine.player.emoji) {
engine.player.emoji = '🏎️';
}
engine.player.renderMode = 'emoji';
console.log('✅ Racing properties fixed!');
console.log('🏎️ Try arrow keys now...');
return engine.player;
}
};
}
console.log(`
🎯 DEBUGGING COMMANDS:
- debugCurrentGame() - Inspect current game
- quickFixRacing() - Force fix racing properties
- Look for racing debug logs when pressing arrow keys
`);