The browser may be caching the old JavaScript files.
Windows/Linux:
- Press
Ctrl + Shift + RorCtrl + F5
Mac:
- Press
Cmd + Shift + R
Alternative:
- Open DevTools (F12)
- Right-click the refresh button
- Select "Empty Cache and Hard Reload"
Open browser console (F12) and check for errors:
- Look for 404 errors (file not found)
- Look for import errors
- Check if CollisionSystem.js is loaded
// Open console and type:
console.log(window.location.href);
// Should show the correct URL
// Check if modules are loadingcd vampire-survivor
ls -la js/game/CollisionSystem.js
ls -la js/config/CollisionConfig.jsBoth files should exist.
git statusShould show:
- Modified: js/entities/Enemy.js
- Modified: js/entities/NeutralEntity.js
- Modified: js/main.js
- Untracked: js/game/CollisionSystem.js
- Untracked: js/config/CollisionConfig.js
node --check vampire-survivor/js/game/CollisionSystem.js
node --check vampire-survivor/js/entities/Enemy.js
node --check vampire-survivor/js/main.jsAll should pass without errors.
- Open the game in browser
- Press F12 to open DevTools
- Go to Console tab
- Look for any red error messages
- Check Network tab to see if all files loaded (200 status)
Cause: File path is incorrect or file doesn't exist Fix:
- Verify file exists at correct path
- Check import statement matches file location
- Ensure file extension is .js
Cause: JavaScript syntax error in code Fix:
- Run
node --checkon the file - Check for missing brackets, semicolons
- Verify ES6 module syntax is correct
Possible causes:
-
Service Worker caching
- Open DevTools → Application → Service Workers
- Unregister any service workers
- Hard refresh again
-
Configuration disabled
- Check
js/config/CollisionConfig.js - Verify
performance.enabled: true - Verify
neutral.enabled: true
- Check
-
Enemies not close enough
- Enemies need to overlap to collide
- Wait for more enemies to spawn
- Move player to group enemies together
Add console logging to verify collision system is running:
static resolveEnemyCollisions(enemies) {
console.log('Checking collisions for', enemies.length, 'enemies');
if (!CollisionConfig.performance.enabled) {
console.log('Collision system disabled');
return;
}
// ... rest of code// Resolve enemy-to-enemy collisions with momentum transfer
CollisionSystem.resolveEnemyCollisions(game.enemies);
console.log('Collision check complete');When working correctly, you should see:
- Enemies moving toward player
- When 2+ enemies get close, they bounce apart
- Enemies spread out naturally instead of stacking
- Filled neutral entities block enemies
- Enemies bounce off neutral entities
- Hard refreshed browser (Ctrl+Shift+R)
- No errors in browser console
- All files show 200 status in Network tab
- At least 5-10 enemies spawned
- Enemies are close enough to collide
- CollisionConfig.performance.enabled is true
- Tried moving player to group enemies
Open console and type:
// This won't work in browser, but shows the concept
// Enemies should have vx and vy propertiesEdit CollisionConfig.js:
enemy: {
restitution: 0.95, // Very bouncy - easier to see
mass: 1.0,
separationFactor: 1.0 // More aggressive separation
}Edit GameState.js:
enemySpawner: {
spawnInterval: 0.5, // Spawn faster (was 2)
maxEnemies: 50
}If collisions still aren't visible after all troubleshooting:
-
Check browser compatibility
- Use Chrome, Firefox, or Edge (latest version)
- ES6 modules required
-
Verify server is serving files
- If using
file://protocol, switch to HTTP server - Run:
python3 -m http.server 8000 - Access via
http://localhost:8000
- If using
-
Check for JavaScript errors
- Any error will stop execution
- Fix all console errors first
-
Verify imports are correct
- Check all import paths
- Ensure case-sensitive paths match files
If issue persists, provide:
- Browser console screenshot (F12)
- Network tab screenshot showing loaded files
- Git status output
- Browser and OS version
To quickly verify the system is working:
- Open game
- Hard refresh (Ctrl+Shift+R)
- Wait for 10+ enemies to spawn
- Move player in circles
- Enemies should bounce off each other
- If not, check console for errors
✅ No errors in console ✅ CollisionSystem.js loads (check Network tab) ✅ Enemies have velocity (they accelerate, not instant speed) ✅ Enemies bounce when they touch ✅ Neutrals block enemies when filled