diff --git a/pacman.html b/pacman.html
index 65396d1..b20d22f 100644
--- a/pacman.html
+++ b/pacman.html
@@ -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();