-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-racing-input.js
More file actions
52 lines (44 loc) · 1.79 KB
/
test-racing-input.js
File metadata and controls
52 lines (44 loc) · 1.79 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
// Test script to verify racing input is working
console.log('🏁 RACING INPUT TEST SCRIPT');
console.log('----------------------------');
// Wait for game engine to be available
function waitForGameEngine() {
if (window.gameEngine) {
console.log('✅ Game engine found!');
testRacingInput();
} else {
console.log('⏳ Waiting for game engine...');
setTimeout(waitForGameEngine, 1000);
}
}
function testRacingInput() {
const engine = window.gameEngine;
console.log('🎮 GAME ENGINE INSPECTION:');
console.log('- Game Type:', engine.gameData.gameType);
console.log('- Player exists:', !!engine.player);
console.log('- Keys set size:', engine.keys.size);
console.log('- Current keys:', Array.from(engine.keys));
if (engine.player) {
console.log('🏎️ PLAYER INSPECTION:');
console.log('- Position:', { x: engine.player.x, y: engine.player.y });
console.log('- Physics:', engine.player.physics);
console.log('- Current Speed:', engine.player.currentSpeed);
console.log('- Steering Angle:', engine.player.steeringAngle);
console.log('- Facing Angle:', engine.player.facingAngle);
console.log('- Velocity:', engine.player.velocity);
}
console.log('');
console.log('🔥 KEYBOARD INPUT TEST:');
console.log('Press arrow keys or WASD and watch for:');
console.log('1. "🎮 KEY DOWN:" logs');
console.log('2. "🎮 Racing input detected:" logs');
console.log('3. "🚨 INPUT DEBUG:" logs');
console.log('4. Car movement on screen');
console.log('');
console.log('If you see key logs but no movement, the physics might need adjustment.');
}
// Start the test
waitForGameEngine();
// Also set up a manual trigger
window.testRacingInput = testRacingInput;
console.log('💡 TIP: If game engine is already loaded, run: testRacingInput()');