Spaces:
Running
Running
| document.addEventListener('DOMContentLoaded', () => { | |
| // Hide loading screen when all components are ready | |
| setTimeout(() => { | |
| document.getElementById('loading').style.opacity = '0'; | |
| setTimeout(() => { | |
| document.getElementById('loading').style.display = 'none'; | |
| }, 500); | |
| }, 1000); | |
| // Game state | |
| let coins = 10; | |
| let unlockedSymbols = ['๐', '๐', '๐']; | |
| const rareSymbols = ['7๏ธโฃ', '๐ฐ', '๐', '๐']; | |
| const jackpotSymbols = ['๐ฐ']; | |
| // Update coin display | |
| function updateCoins() { | |
| document.getElementById('coin-counter').textContent = `Coins: ${coins}`; | |
| } | |
| // Play sound | |
| function playSound(id) { | |
| const sound = document.getElementById(id); | |
| sound.currentTime = 0; | |
| sound.play(); | |
| } | |
| // Initialize game | |
| updateCoins(); | |
| // Expose functions to components | |
| window.gameState = { | |
| coins, | |
| unlockedSymbols, | |
| rareSymbols, | |
| jackpotSymbols, | |
| updateCoins, | |
| playSound | |
| }; | |
| }); | |
| // Helper function for components to update game state | |
| function updateGameState(newState) { | |
| Object.assign(window.gameState, newState); | |
| if (window.gameState.updateCoins) { | |
| window.gameState.updateCoins(); | |
| } | |
| } |