simplified game start logic - removed attract mode complexity

This commit is contained in:
2026-02-02 17:04:53 +00:00
parent a02eb6149a
commit 0e20e6d030

View File

@@ -834,42 +834,21 @@
function handleSpaceButton() {
console.log('Space button pressed, current game state:', gameState);
// Force game to start regardless of current state for testing
gameState = 'READY';
readyTimer = 180;
// Simple direct logic - just start the game
gameState = 'PLAYING';
startScreenElement.style.display = 'none';
gameOverElement.style.display = 'none';
resetPositions();
soundSystem.play('ready');
console.log('Force switched to READY state');
console.log('Game started in PLAYING state');
updateDebugInfo();
// Original logic (commented out for testing)
/*
if (gameState === 'ATTRACT') {
gameState = 'START';
attractModeTimer = 0;
// Play sound if available
try {
soundSystem.play('ready');
console.log('Switched to START state');
} else if (gameState === 'START') {
gameState = 'READY';
readyTimer = 180;
startScreenElement.style.display = 'none';
resetPositions();
soundSystem.play('ready');
console.log('Switched to READY state');
} else if (gameState === 'GAME_OVER') {
gameState = 'START';
gameOverElement.style.display = 'none';
score = 0;
lives = 3;
currentLevel = 1;
updateScore();
updateLives();
maze = JSON.parse(JSON.stringify(mazeLayout));
soundSystem.play('ready');
console.log('Restarted game');
} catch (e) {
console.log('Sound not available:', e);
}
*/
}
// Initialize mobile controls if needed
@@ -899,9 +878,20 @@
handleSpaceButton();
};
// Start with attract mode
gameState = 'ATTRACT';
// Start with START state instead of ATTRACT for easier testing
gameState = 'START';
attractModeTimer = 0;
// Show start screen immediately
startScreenElement.style.display = 'block';
console.log('Game starting in START state');
console.log('Start screen visible:', startScreenElement.style.display);
// Test if JavaScript is working
alert('JavaScript is loaded! Click OK to continue.');
// Start game loop
gameLoop();
</script>
</body>