synthos 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/default-pages/elevenlabs_effects_studio/chat-history.json +1 -0
- package/default-pages/elevenlabs_effects_studio/page.html +1345 -1363
- package/default-pages/elevenlabs_effects_studio/page.json +13 -11
- package/default-pages/elevenlabs_voice_studio/chat-history.json +1 -0
- package/default-pages/elevenlabs_voice_studio/page.html +782 -801
- package/default-pages/elevenlabs_voice_studio/page.json +13 -11
- package/default-pages/json_tools/chat-history.json +1 -0
- package/default-pages/json_tools/page.html +70 -90
- package/default-pages/json_tools/page.json +12 -10
- package/default-pages/my_notes/chat-history.json +1 -0
- package/default-pages/my_notes/page.html +115 -131
- package/default-pages/my_notes/page.json +14 -12
- package/default-pages/neon_asteroids/chat-history.json +1 -0
- package/default-pages/neon_asteroids/page.html +1777 -1803
- package/default-pages/neon_asteroids/page.json +14 -12
- package/default-pages/oregon_trail/chat-history.json +1 -0
- package/default-pages/oregon_trail/page.html +290 -307
- package/default-pages/oregon_trail/page.json +14 -12
- package/default-pages/solar_explorer/chat-history.json +1 -0
- package/default-pages/solar_explorer/page.html +1929 -1951
- package/default-pages/solar_explorer/page.json +14 -12
- package/default-pages/solar_tutorial/chat-history.json +1 -0
- package/default-pages/solar_tutorial/page.html +464 -478
- package/default-pages/solar_tutorial/page.json +12 -10
- package/default-pages/us_map/chat-history.json +1 -0
- package/default-pages/us_map/page.html +170 -193
- package/default-pages/us_map/page.json +14 -12
- package/default-pages/us_map/page.light.png +0 -0
- package/default-pages/us_map_1850/chat-history.json +1 -0
- package/default-pages/us_map_1850/page.html +302 -326
- package/default-pages/us_map_1850/page.json +14 -12
- package/default-pages/western_cities_1850/chat-history.json +1 -0
- package/default-pages/western_cities_1850/page.html +503 -527
- package/default-pages/western_cities_1850/page.json +14 -12
- package/default-themes/aurora-dawn.v3.css +15 -14
- package/default-themes/aurora-dusk.v3.css +26 -26
- package/default-themes/cosmos-dawn.v3.css +15 -14
- package/default-themes/cosmos-dusk.v3.css +26 -26
- package/default-themes/elemental-dawn.v3.css +200 -0
- package/default-themes/nebula-dawn.v3.css +15 -14
- package/default-themes/nebula-dusk.v3.css +24 -24
- package/default-themes/solar-flare-dawn.v3.css +15 -14
- package/default-themes/solar-flare-dusk.v3.css +26 -26
- package/dist/builders/anthropic.d.ts +26 -2
- package/dist/builders/anthropic.d.ts.map +1 -1
- package/dist/builders/anthropic.js +132 -31
- package/dist/builders/anthropic.js.map +1 -1
- package/dist/builders/claudecode.d.ts +13 -0
- package/dist/builders/claudecode.d.ts.map +1 -0
- package/dist/builders/claudecode.js +253 -0
- package/dist/builders/claudecode.js.map +1 -0
- package/dist/builders/index.d.ts +2 -1
- package/dist/builders/index.d.ts.map +1 -1
- package/dist/builders/index.js +8 -1
- package/dist/builders/index.js.map +1 -1
- package/dist/builders/openai.js +2 -1
- package/dist/builders/openai.js.map +1 -1
- package/dist/builders/types.d.ts +31 -7
- package/dist/builders/types.d.ts.map +1 -1
- package/dist/builders/types.js +60 -28
- package/dist/builders/types.js.map +1 -1
- package/dist/connectors/types.d.ts +8 -0
- package/dist/connectors/types.d.ts.map +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +13 -6
- package/dist/init.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +161 -14
- package/dist/migrations.js.map +1 -1
- package/dist/models/anthropic.d.ts +1 -0
- package/dist/models/anthropic.d.ts.map +1 -1
- package/dist/models/anthropic.js +129 -29
- package/dist/models/anthropic.js.map +1 -1
- package/dist/models/chainOfThought.d.ts.map +1 -1
- package/dist/models/chainOfThought.js +32 -19
- package/dist/models/chainOfThought.js.map +1 -1
- package/dist/models/index.d.ts +2 -2
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +2 -1
- package/dist/models/index.js.map +1 -1
- package/dist/models/providers.d.ts +1 -0
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/models/providers.js +12 -4
- package/dist/models/providers.js.map +1 -1
- package/dist/models/types.d.ts +15 -1
- package/dist/models/types.d.ts.map +1 -1
- package/dist/models/types.js.map +1 -1
- package/dist/pages.d.ts +57 -8
- package/dist/pages.d.ts.map +1 -1
- package/dist/pages.js +258 -45
- package/dist/pages.js.map +1 -1
- package/dist/service/createCompletePrompt.d.ts.map +1 -1
- package/dist/service/createCompletePrompt.js +5 -0
- package/dist/service/createCompletePrompt.js.map +1 -1
- package/dist/service/mediaCache.d.ts +36 -0
- package/dist/service/mediaCache.d.ts.map +1 -0
- package/dist/service/mediaCache.js +182 -0
- package/dist/service/mediaCache.js.map +1 -0
- package/dist/service/pageValidator.d.ts +25 -0
- package/dist/service/pageValidator.d.ts.map +1 -0
- package/dist/service/pageValidator.js +315 -0
- package/dist/service/pageValidator.js.map +1 -0
- package/dist/service/server.d.ts.map +1 -1
- package/dist/service/server.js +4 -0
- package/dist/service/server.js.map +1 -1
- package/dist/service/sharedTableSchema.d.ts +73 -0
- package/dist/service/sharedTableSchema.d.ts.map +1 -0
- package/dist/service/sharedTableSchema.js +206 -0
- package/dist/service/sharedTableSchema.js.map +1 -0
- package/dist/service/transformPage.d.ts +49 -11
- package/dist/service/transformPage.d.ts.map +1 -1
- package/dist/service/transformPage.js +354 -241
- package/dist/service/transformPage.js.map +1 -1
- package/dist/service/useApiRoutes.d.ts.map +1 -1
- package/dist/service/useApiRoutes.js +288 -34
- package/dist/service/useApiRoutes.js.map +1 -1
- package/dist/service/useConnectorRoutes.d.ts.map +1 -1
- package/dist/service/useConnectorRoutes.js +170 -32
- package/dist/service/useConnectorRoutes.js.map +1 -1
- package/dist/service/useDataRoutes.d.ts.map +1 -1
- package/dist/service/useDataRoutes.js +59 -2
- package/dist/service/useDataRoutes.js.map +1 -1
- package/dist/service/useExtractRoutes.d.ts +4 -0
- package/dist/service/useExtractRoutes.d.ts.map +1 -0
- package/dist/service/useExtractRoutes.js +304 -0
- package/dist/service/useExtractRoutes.js.map +1 -0
- package/dist/service/usePageRoutes.d.ts +17 -0
- package/dist/service/usePageRoutes.d.ts.map +1 -1
- package/dist/service/usePageRoutes.js +1385 -483
- package/dist/service/usePageRoutes.js.map +1 -1
- package/dist/service/useSharedDataRoutes.d.ts.map +1 -1
- package/dist/service/useSharedDataRoutes.js +54 -2
- package/dist/service/useSharedDataRoutes.js.map +1 -1
- package/dist/settings.d.ts +27 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +40 -1
- package/dist/settings.js.map +1 -1
- package/dist/themes.d.ts +0 -5
- package/dist/themes.d.ts.map +1 -1
- package/dist/themes.js +3 -95
- package/dist/themes.js.map +1 -1
- package/migration-rules/v2-to-v3.md +277 -119
- package/package.json +5 -1
- package/{default-pages/application → required-pages/_shell}/page.html +56 -42
- package/required-pages/_shell/page.json +14 -0
- package/required-pages/_starters/page.html +534 -0
- package/required-pages/_starters/page.json +12 -0
- package/required-pages/builder/page.html +353 -43
- package/required-pages/builder/page.json +12 -10
- package/required-pages/pages/page.html +697 -924
- package/required-pages/pages/page.json +12 -10
- package/required-pages/settings/page.html +1879 -1753
- package/required-pages/settings/page.json +12 -10
- package/required-pages/synthos_apis/page.html +834 -845
- package/required-pages/synthos_apis/page.json +12 -10
- package/required-pages/synthos_scripts/page.html +74 -88
- package/required-pages/synthos_scripts/page.json +12 -10
- package/scripts/append-instructions.py +90 -0
- package/scripts/audit-instructions.py +76 -0
- package/scripts/cleanup-shell-markup.mjs +112 -0
- package/service-connectors/buffer/connector.json +46 -0
- package/service-connectors/canva/connector.json +67 -0
- package/service-connectors/elevenlabs/connector.json +1 -1
- package/src/builders/anthropic.ts +155 -30
- package/src/builders/claudecode.ts +310 -0
- package/src/builders/index.ts +7 -1
- package/src/builders/openai.ts +2 -1
- package/src/builders/types.ts +93 -32
- package/src/connectors/types.ts +8 -0
- package/src/init.ts +13 -7
- package/src/migrations.ts +187 -16
- package/src/models/anthropic.ts +140 -30
- package/src/models/chainOfThought.ts +33 -18
- package/src/models/index.ts +2 -2
- package/src/models/providers.ts +12 -3
- package/src/models/types.ts +21 -1
- package/src/pages.ts +271 -35
- package/src/service/createCompletePrompt.ts +6 -0
- package/src/service/mediaCache.ts +206 -0
- package/src/service/pageValidator.ts +337 -0
- package/src/service/server.ts +4 -0
- package/src/service/sharedTableSchema.ts +236 -0
- package/src/service/transformPage.ts +370 -260
- package/src/service/useApiRoutes.ts +282 -32
- package/src/service/useConnectorRoutes.ts +189 -34
- package/src/service/useDataRoutes.ts +198 -116
- package/src/service/useExtractRoutes.ts +331 -0
- package/src/service/usePageRoutes.ts +1411 -394
- package/src/service/useSharedDataRoutes.ts +184 -109
- package/src/settings.ts +65 -0
- package/src/themes.ts +78 -180
- package/starters/blank_starter/chat-history.json +1 -0
- package/starters/blank_starter/page.dark.png +0 -0
- package/starters/blank_starter/page.html +47 -0
- package/starters/blank_starter/page.json +13 -0
- package/starters/blank_starter/page.light.png +0 -0
- package/starters/calculator_starter/chat-history.json +1 -0
- package/starters/calculator_starter/page.dark.png +0 -0
- package/starters/calculator_starter/page.html +232 -0
- package/starters/calculator_starter/page.json +13 -0
- package/starters/calculator_starter/page.light.png +0 -0
- package/starters/calendar_starter/chat-history.json +1 -0
- package/starters/calendar_starter/page.dark.png +0 -0
- package/starters/calendar_starter/page.html +495 -0
- package/starters/calendar_starter/page.json +13 -0
- package/starters/calendar_starter/page.light.png +0 -0
- package/starters/chat_starter/chat-history.json +1 -0
- package/starters/chat_starter/page.dark.png +0 -0
- package/starters/chat_starter/page.html +351 -0
- package/starters/chat_starter/page.json +13 -0
- package/starters/chat_starter/page.light.png +0 -0
- package/starters/checklist_starter/chat-history.json +1 -0
- package/starters/checklist_starter/page.dark.png +0 -0
- package/starters/checklist_starter/page.html +437 -0
- package/starters/checklist_starter/page.json +13 -0
- package/starters/checklist_starter/page.light.png +0 -0
- package/starters/dashboard_starter/chat-history.json +1 -0
- package/starters/dashboard_starter/page.dark.png +0 -0
- package/starters/dashboard_starter/page.html +195 -0
- package/starters/dashboard_starter/page.json +13 -0
- package/starters/dashboard_starter/page.light.png +0 -0
- package/starters/form_starter/chat-history.json +1 -0
- package/starters/form_starter/page.dark.png +0 -0
- package/starters/form_starter/page.html +313 -0
- package/starters/form_starter/page.json +13 -0
- package/starters/form_starter/page.light.png +0 -0
- package/starters/gallery_starter/chat-history.json +1 -0
- package/starters/gallery_starter/page.dark.png +0 -0
- package/starters/gallery_starter/page.html +418 -0
- package/starters/gallery_starter/page.json +13 -0
- package/starters/gallery_starter/page.light.png +0 -0
- package/starters/generator_starter/chat-history.json +1 -0
- package/starters/generator_starter/page.dark.png +0 -0
- package/starters/generator_starter/page.html +261 -0
- package/starters/generator_starter/page.json +13 -0
- package/starters/generator_starter/page.light.png +0 -0
- package/starters/index.html +538 -0
- package/starters/kanban_starter/chat-history.json +1 -0
- package/starters/kanban_starter/page.dark.png +0 -0
- package/starters/kanban_starter/page.html +432 -0
- package/starters/kanban_starter/page.json +13 -0
- package/starters/kanban_starter/page.light.png +0 -0
- package/starters/presentation_builder/chat-history.json +1 -0
- package/starters/presentation_builder/page.dark.png +0 -0
- package/starters/presentation_builder/page.html +970 -0
- package/starters/presentation_builder/page.json +15 -0
- package/starters/presentation_builder/page.light.png +0 -0
- package/starters/presentation_builder/presentation_voice/voice_config.json +9 -0
- package/starters/pulse_starter/chat-history.json +1 -0
- package/starters/pulse_starter/page.dark.png +0 -0
- package/starters/pulse_starter/page.html +698 -0
- package/starters/pulse_starter/page.json +13 -0
- package/starters/pulse_starter/page.light.png +0 -0
- package/starters/quiz_starter/chat-history.json +1 -0
- package/starters/quiz_starter/page.dark.png +0 -0
- package/starters/quiz_starter/page.html +292 -0
- package/starters/quiz_starter/page.json +13 -0
- package/starters/quiz_starter/page.light.png +0 -0
- package/starters/reference_starter/chat-history.json +1 -0
- package/starters/reference_starter/page.dark.png +0 -0
- package/starters/reference_starter/page.html +250 -0
- package/starters/reference_starter/page.json +13 -0
- package/starters/reference_starter/page.light.png +0 -0
- package/starters/retro_game_starter/chat-history.json +1 -0
- package/starters/retro_game_starter/page.dark.png +0 -0
- package/{default-pages → starters}/retro_game_starter/page.html +1281 -1308
- package/starters/retro_game_starter/page.json +15 -0
- package/starters/retro_game_starter/page.light.png +0 -0
- package/starters/roster_starter/chat-history.json +1 -0
- package/starters/roster_starter/page.dark.png +0 -0
- package/starters/roster_starter/page.html +600 -0
- package/starters/roster_starter/page.json +13 -0
- package/starters/roster_starter/page.light.png +0 -0
- package/starters/server.js +182 -0
- package/starters/start.cmd +1 -0
- package/starters/timeline_starter/chat-history.json +1 -0
- package/starters/timeline_starter/page.dark.png +0 -0
- package/starters/timeline_starter/page.html +446 -0
- package/starters/timeline_starter/page.json +13 -0
- package/starters/timeline_starter/page.light.png +0 -0
- package/starters/tutorial_starter/chat-history.json +1 -0
- package/starters/tutorial_starter/page.dark.png +0 -0
- package/starters/tutorial_starter/page.html +283 -0
- package/starters/tutorial_starter/page.json +13 -0
- package/starters/tutorial_starter/page.light.png +0 -0
- package/static-files/agent.v3.js +122 -0
- package/static-files/connector.v3.js +48 -0
- package/static-files/extract.v3.js +188 -0
- package/static-files/helpers.v3.js +50 -6
- package/static-files/page-bridge.js +114 -0
- package/static-files/page.v3.js +1292 -1290
- package/static-files/script.v3.js +32 -0
- package/static-files/server.v3.js +89 -0
- package/static-files/shell-bridge.v3.js +174 -0
- package/static-files/shell-modals.v3.js +521 -0
- package/static-files/{shell.css → shell.v3.css} +271 -22
- package/static-files/shell.v3.js +1865 -0
- package/static-files/storage.v3.js +176 -0
- package/tests/anthropic.spec.ts +42 -7
- package/tests/builders.spec.ts +72 -4
- package/tests/pageValidator.spec.ts +548 -0
- package/tests/profiles.spec.ts +122 -0
- package/tests/providers.spec.ts +1 -1
- package/tests/sharedTableSchema.spec.ts +242 -0
- package/tests/transformPage.spec.ts +62 -81
- package/default-pages/application/page.json +0 -10
- package/default-pages/retro_game_starter/page.json +0 -12
- package/default-pages/sidebar_page/page.html +0 -51
- package/default-pages/sidebar_page/page.json +0 -10
- package/default-pages/two-panel_page/page.html +0 -68
- package/default-pages/two-panel_page/page.json +0 -10
|
@@ -1,1803 +1,1777 @@
|
|
|
1
|
-
<!DOCTYPE html><html lang="en"><head>
|
|
2
|
-
<meta charset="UTF-8">
|
|
3
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
4
|
-
<title>SynthOS</title>
|
|
5
|
-
<script id="theme-info" src="/api/theme-info.js" data-locked="true"></script>
|
|
6
|
-
<link id="theme-css" rel="stylesheet" href="/api/theme.css" data-locked="true">
|
|
7
|
-
<style>
|
|
8
|
-
#game-wrapper{width:100%;height:100%;display:flex;align-items:flex-start;justify-content:center;background:#000;overflow:hidden}
|
|
9
|
-
#game-container{position:relative;border:1px solid rgba(0,255,255,.25);box-shadow:0 0 24px rgba(0,255,255,.1),inset 0 0 24px rgba(0,255,255,.05);overflow:hidden;flex-shrink:0}
|
|
10
|
-
#gameCanvas{display:block;width:100%;height:100%}
|
|
11
|
-
.game-ui{position:absolute;top:20px;left:20px;right:20px;display:flex;justify-content:space-between;pointer-events:none;z-index:10}
|
|
12
|
-
.level-display,.lives-display,.score-display{font-family:Orbitron,'Segoe UI',sans-serif;font-size:18px;color:#0ff;text-shadow:0 0 10px #0ff,0 0 20px #0ff;letter-spacing:2px}
|
|
13
|
-
.mute-btn{pointer-events:auto;background:none;border:1px solid rgba(0,255,255,.4);border-radius:4px;color:#0ff;cursor:pointer;padding:2px 6px;font-size:16px;line-height:1;opacity:.7;transition:opacity .2s}.mute-btn:hover{opacity:1}
|
|
14
|
-
.player-indicator{font-family:Orbitron,'Segoe UI',sans-serif;font-size:18px;text-shadow:0 0 10px currentColor,0 0 20px currentColor;letter-spacing:2px;margin-right:8px}
|
|
15
|
-
.game-over-screen,.start-screen{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);text-align:center;z-index:20}
|
|
16
|
-
.game-over-screen h1,.start-screen h1{font-family:Orbitron,'Segoe UI',sans-serif;font-size:48px;line-height:1.2;color:#f0f;text-shadow:0 0 20px #f0f,0 0 40px #f0f,0 0 60px #f0f;margin-bottom:20px;letter-spacing:5px}
|
|
17
|
-
.game-over-screen p,.start-screen p{font-size:18px;color:#0ff;text-shadow:0 0 10px #0ff;margin-bottom:30px}
|
|
18
|
-
.restart-btn,.start-btn,.mode-btn{padding:15px 40px;font-size:18px;font-family:Orbitron,'Segoe UI',sans-serif;background:0 0;border:2px solid #0ff;color:#0ff;cursor:pointer;text-transform:uppercase;letter-spacing:3px;transition:.3s;box-shadow:0 0 20px rgba(0,255,255,.3),inset 0 0 20px rgba(0,255,255,.1)}
|
|
19
|
-
.restart-btn:hover,.start-btn:hover,.mode-btn:hover{background:rgba(0,255,255,.2);box-shadow:0 0 30px rgba(0,255,255,.5),inset 0 0 30px rgba(0,255,255,.2);transform:scale(1.05)}
|
|
20
|
-
.controls-info{position:absolute;bottom:16px;right:20px;font-size:13px;color:rgba(0,255,255,.5);text-align:right;letter-spacing:1px;display:flex;align-items:center;gap:16px;font-family:'Segoe UI',sans-serif}
|
|
21
|
-
.controls-info .action-item{display:inline-flex;align-items:center;gap:4px}
|
|
22
|
-
|
|
23
|
-
/* Mode selection */
|
|
24
|
-
.mode-select{display:flex;flex-direction:column;gap:12px;align-items:center;margin-bottom:20px}
|
|
25
|
-
.mode-btn{padding:12px 36px;font-size:16px;min-width:240px}
|
|
26
|
-
.mode-btn.selected{background:rgba(0,255,255,.25);border-color:#fff;color:#fff;box-shadow:0 0 30px rgba(0,255,255,.6),inset 0 0 20px rgba(0,255,255,.3)}
|
|
27
|
-
|
|
28
|
-
/* Player count selector */
|
|
29
|
-
.player-count-select{display:none;flex-direction:column;align-items:center;gap:12px;margin-top:16px}
|
|
30
|
-
.player-count-select.visible{display:flex}
|
|
31
|
-
.player-count-row{display:flex;align-items:center;gap:16px}
|
|
32
|
-
.player-count-arrow{font-size:28px;color:#0ff;cursor:pointer;user-select:none;text-shadow:0 0 10px #0ff;padding:4px 12px;transition:.2s}
|
|
33
|
-
.player-count-arrow:hover{color:#fff;text-shadow:0 0 15px #fff}
|
|
34
|
-
.player-count-num{font-family:Orbitron,'Segoe UI',sans-serif;font-size:36px;color:#f0f;text-shadow:0 0 15px #f0f,0 0 30px #f0f;min-width:50px;text-align:center}
|
|
35
|
-
.player-count-label{font-size:14px;color:rgba(0,255,255,.6);letter-spacing:2px}
|
|
36
|
-
.player-count-confirm{margin-top:8px}
|
|
37
|
-
|
|
38
|
-
/* Sub-mode selection */
|
|
39
|
-
.submode-select{display:none;flex-direction:column;align-items:center;gap:12px;margin-top:16px}
|
|
40
|
-
.submode-select.visible{display:flex}
|
|
41
|
-
.submode-title{font-family:Orbitron,'Segoe UI',sans-serif;font-size:14px;color:rgba(0,255,255,.7);letter-spacing:2px;margin-bottom:4px}
|
|
42
|
-
.submode-btn{padding:10px 30px;font-size:14px;min-width:220px;font-family:Orbitron,'Segoe UI',sans-serif;background:0 0;border:2px solid #0ff;color:#0ff;cursor:pointer;text-transform:uppercase;letter-spacing:2px;transition:.3s;box-shadow:0 0 15px rgba(0,255,255,.2),inset 0 0 15px rgba(0,255,255,.08)}
|
|
43
|
-
.submode-btn:hover{background:rgba(0,255,255,.2);box-shadow:0 0 25px rgba(0,255,255,.5);transform:scale(1.03)}
|
|
44
|
-
.submode-desc{font-size:11px;color:rgba(0,255,255,.45);font-family:'Segoe UI',sans-serif;max-width:280px;text-align:center;margin-top:-4px}
|
|
45
|
-
|
|
46
|
-
/* Side panels */
|
|
47
|
-
.side-panel{width:200px;flex-shrink:0;padding:20px 16px;display:flex;flex-direction:column;font-family:Orbitron,'Segoe UI',sans-serif;box-sizing:border-box;overflow:hidden}
|
|
48
|
-
.side-panel.hidden{display:none}
|
|
49
|
-
.side-panel h2{font-size:16px;letter-spacing:3px;margin:0 0 16px 0;text-align:center;font-weight:700}
|
|
50
|
-
#side-leaderboard{color:#f0f;text-shadow:0 0 10px #f0f,0 0 20px rgba(255,0,255,.4)}
|
|
51
|
-
#side-leaderboard h2{color:#f0f;text-shadow:0 0 10px #f0f,0 0 20px #f0f}
|
|
52
|
-
#side-controls{color:#0ff;text-shadow:0 0 10px #0ff,0 0 20px rgba(0,255,255,.4)}
|
|
53
|
-
#side-controls h2{color:#0ff;text-shadow:0 0 10px #0ff,0 0 20px #0ff}
|
|
54
|
-
.leaderboard-table{width:100%;border-collapse:collapse;font-family:'Courier New',monospace;font-size:13px}
|
|
55
|
-
.leaderboard-table td{padding:4px 0;white-space:nowrap}
|
|
56
|
-
.leaderboard-table .rank{width:24px;color:rgba(255,0,255,.6);text-align:right;padding-right:6px}
|
|
57
|
-
.leaderboard-table .initials{color:#f0f;letter-spacing:2px}
|
|
58
|
-
.leaderboard-table .hs-score{text-align:right;color:rgba(255,0,255,.7);position:relative;cursor:default}
|
|
59
|
-
.leaderboard-table .hs-score.overflow{animation:scoreFlash 0.8s ease-in-out infinite}
|
|
60
|
-
.leaderboard-table .hs-score[title]:hover::after{content:attr(title);position:absolute;right:0;top:-22px;background:#1a0028;color:#f0f;font-size:11px;padding:2px 6px;border:1px solid rgba(255,0,255,.4);border-radius:3px;white-space:nowrap;z-index:5;pointer-events:none}
|
|
61
|
-
@keyframes scoreFlash{0%,100%{opacity:1}50%{opacity:.4}}
|
|
62
|
-
.score-display .score-overflow{animation:hudScoreFlash 0.8s ease-in-out infinite}
|
|
63
|
-
@keyframes hudScoreFlash{0%,100%{color:#0ff;text-shadow:0 0 10px #0ff,0 0 20px #0ff}50%{color:#f0f;text-shadow:0 0 10px #f0f,0 0 20px #f0f}}
|
|
64
|
-
.controls-list{list-style:none;padding:0;margin:0;font-size:12px}
|
|
65
|
-
.controls-list li{padding:6px 0;display:flex;gap:8px;align-items:center;color:#0ff}
|
|
66
|
-
.controls-list .key-icon{display:inline-block;min-width:50px;padding:2px 6px;border:1px solid rgba(0,255,255,.4);border-radius:3px;text-align:center;font-size:11px;color:#0ff;background:rgba(0,255,255,.05);flex-shrink:0}
|
|
67
|
-
.controls-list .key-desc{color:rgba(0,255,255,.7);font-family:'Segoe UI',sans-serif}
|
|
68
|
-
.bt-section{margin-top:auto;padding-top:16px;border-top:1px solid rgba(0,255,255,.15)}
|
|
69
|
-
.bt-section h3{font-size:11px;letter-spacing:2px;color:rgba(0,255,255,.5);margin:0 0 8px 0;text-align:center;font-weight:400}
|
|
70
|
-
.bt-section p{font-size:11px;color:rgba(0,255,255,.4);font-family:'Segoe UI',sans-serif;margin:0 0 4px 0;line-height:1.4}
|
|
71
|
-
.side-panel{overflow-y:auto}
|
|
72
|
-
#side-leaderboard{padding-top:20px}
|
|
73
|
-
#side-controls{padding-top:20px}
|
|
74
|
-
|
|
75
|
-
/* Gamepad status indicator */
|
|
76
|
-
#gamepadStatus{text-align:center;padding:8px 0;margin-bottom:12px;font-size:11px;letter-spacing:2px;border:1px solid rgba(0,255,255,.15);border-radius:4px;transition:all .3s;color:rgba(0,255,255,.3);text-shadow:none}
|
|
77
|
-
#gamepadStatus.connected{color:#0f0;text-shadow:0 0 8px #0f0,0 0 16px rgba(0,255,0,.4);border-color:rgba(0,255,0,.3);background:rgba(0,255,0,.05);animation:gpPulse 2s ease-in-out infinite}
|
|
78
|
-
@keyframes gpPulse{0%,100%{box-shadow:0 0 4px rgba(0,255,0,.1)}50%{box-shadow:0 0 12px rgba(0,255,0,.25)}}
|
|
79
|
-
|
|
80
|
-
/* Pause overlay */
|
|
81
|
-
#pauseOverlay{position:absolute;top:0;left:0;right:0;bottom:0;display:none;align-items:center;justify-content:center;z-index:25;background:rgba(0,0,0,.5);flex-direction:column;gap:8px}
|
|
82
|
-
#pauseOverlay.visible{display:flex}
|
|
83
|
-
#pauseOverlay .pause-title{font-family:Orbitron,'Segoe UI',sans-serif;font-size:48px;color:#0ff;text-shadow:0 0 20px #0ff,0 0 40px #0ff,0 0 60px #0ff;letter-spacing:8px}
|
|
84
|
-
#pauseOverlay .pause-hint{font-family:'Segoe UI',sans-serif;font-size:14px;color:rgba(0,255,255,.5);letter-spacing:1px}
|
|
85
|
-
|
|
86
|
-
/* High score entry */
|
|
87
|
-
#highScoreEntry{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);text-align:center;z-index:30;display:none}
|
|
88
|
-
#highScoreEntry h2{font-family:Orbitron,'Segoe UI',sans-serif;font-size:24px;color:#f0f;text-shadow:0 0 15px #f0f,0 0 30px #f0f;margin-bottom:10px;letter-spacing:3px}
|
|
89
|
-
#highScoreEntry .hs-final-score{font-family:Orbitron,'Segoe UI',sans-serif;font-size:18px;color:#0ff;text-shadow:0 0 10px #0ff;margin-bottom:20px}
|
|
90
|
-
.initial-slots{display:flex;justify-content:center;gap:12px;margin-bottom:20px}
|
|
91
|
-
.initial-slot{width:40px;height:50px;border:2px solid #f0f;display:flex;align-items:center;justify-content:center;font-family:Orbitron,'Segoe UI',sans-serif;font-size:28px;color:#f0f;text-shadow:0 0 10px #f0f;box-shadow:0 0 10px rgba(255,0,255,.3)}
|
|
92
|
-
.initial-slot.active{border-color:#0ff;color:#0ff;text-shadow:0 0 10px #0ff;box-shadow:0 0 15px rgba(0,255,255,.5)}
|
|
93
|
-
.hs-instructions{font-size:12px;color:rgba(0,255,255,.6);font-family:'Segoe UI',sans-serif;margin-bottom:16px}
|
|
94
|
-
|
|
95
|
-
/* Keyboard key hint (for bottom bar) */
|
|
96
|
-
.kb-key{display:inline-block;padding:1px 6px;border:1px solid rgba(0,255,255,.35);border-radius:3px;font-size:11px;color:rgba(0,255,255,.7);background:rgba(0,255,255,.05);vertical-align:middle;margin:0 2px;font-family:'Segoe UI',sans-serif}
|
|
97
|
-
/* Focused menu item */
|
|
98
|
-
.mode-btn.focused,.submode-btn.focused{background:rgba(0,255,255,.2);border-color:#fff;color:#fff;box-shadow:0 0 25px rgba(0,255,255,.5),inset 0 0 20px rgba(0,255,255,.2)}
|
|
99
|
-
|
|
100
|
-
/* Turn ready overlay */
|
|
101
|
-
#turnReadyOverlay{position:absolute;top:0;left:0;right:0;bottom:0;display:none;align-items:center;justify-content:center;flex-direction:column;gap:12px;z-index:26;background:rgba(0,0,0,.7)}
|
|
102
|
-
#turnReadyOverlay.visible{display:flex}
|
|
103
|
-
#turnReadyOverlay .turn-player{font-family:Orbitron,'Segoe UI',sans-serif;font-size:42px;text-shadow:0 0 20px currentColor,0 0 40px currentColor;letter-spacing:6px}
|
|
104
|
-
#turnReadyOverlay .turn-subtitle{font-family:Orbitron,'Segoe UI',sans-serif;font-size:22px;color:#fff;text-shadow:0 0 12px rgba(255,255,255,.6);letter-spacing:4px;margin-bottom:8px}
|
|
105
|
-
#turnReadyOverlay .turn-prompt{font-family:'Segoe UI',sans-serif;font-size:16px;color:rgba(0,255,255,.6);letter-spacing:1px}
|
|
106
|
-
|
|
107
|
-
/* Final scoreboard overlay */
|
|
108
|
-
#finalScoreboard{position:absolute;top:0;left:0;right:0;bottom:0;display:none;align-items:center;justify-content:center;flex-direction:column;gap:16px;z-index:27;background:rgba(0,0,0,.8)}
|
|
109
|
-
#finalScoreboard.visible{display:flex}
|
|
110
|
-
#finalScoreboard .sb-title{font-family:Orbitron,'Segoe UI',sans-serif;font-size:32px;color:#f0f;text-shadow:0 0 20px #f0f,0 0 40px #f0f;letter-spacing:5px;margin-bottom:8px}
|
|
111
|
-
#finalScoreboard .sb-subtitle{font-family:Orbitron,'Segoe UI',sans-serif;font-size:14px;color:rgba(255,255,255,.5);letter-spacing:3px;margin-bottom:12px}
|
|
112
|
-
.sb-table{border-collapse:collapse;font-family:Orbitron,'Segoe UI',sans-serif;font-size:18px}
|
|
113
|
-
.sb-table td{padding:8px 16px}
|
|
114
|
-
.sb-table .sb-rank{color:rgba(255,255,255,.5);text-align:right;font-size:14px}
|
|
115
|
-
.sb-table .sb-player{letter-spacing:3px}
|
|
116
|
-
.sb-table .sb-initials{font-size:14px;color:rgba(255,255,255,.5);letter-spacing:2px}
|
|
117
|
-
.sb-table .sb-score{text-align:right;color:#fff;letter-spacing:2px}
|
|
118
|
-
.sb-play-again{margin-top:16px}
|
|
119
|
-
</style>
|
|
120
|
-
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap" rel="stylesheet">
|
|
121
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
|
122
|
-
</head>
|
|
123
|
-
|
|
124
|
-
<body>
|
|
125
|
-
<div class="
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
<tbody id="
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
<div class="
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
</
|
|
180
|
-
<
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
<div class="
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
</
|
|
197
|
-
<
|
|
198
|
-
<
|
|
199
|
-
<
|
|
200
|
-
<
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
<
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
</
|
|
210
|
-
<
|
|
211
|
-
</
|
|
212
|
-
<div class="
|
|
213
|
-
</div>
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
var
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
function
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
if (
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
function
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
//
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
function
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
function
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
actionItem(
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
document.getElementById("
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
var
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
renderLeaderboard();
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
function
|
|
542
|
-
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
'<
|
|
582
|
-
'<
|
|
583
|
-
'<
|
|
584
|
-
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
function
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
var
|
|
648
|
-
var
|
|
649
|
-
var
|
|
650
|
-
var
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
ship.
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
function
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
function
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
function
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
if (
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
function
|
|
880
|
-
return
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
var
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
function
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
if (gameMode === "solo_turns") {
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
lives
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
var
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
if (
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
|
-
function
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
}
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
function
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
if (
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
if (
|
|
1204
|
-
if (
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
// Update
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
return
|
|
1267
|
-
});
|
|
1268
|
-
|
|
1269
|
-
// Update
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
});
|
|
1275
|
-
|
|
1276
|
-
//
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
}
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
ctx.
|
|
1425
|
-
ctx.
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
ctx.
|
|
1436
|
-
ctx.
|
|
1437
|
-
ctx.
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
ctx.
|
|
1446
|
-
|
|
1447
|
-
ctx.
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
ctx.
|
|
1454
|
-
ctx.
|
|
1455
|
-
ctx.
|
|
1456
|
-
ctx.
|
|
1457
|
-
ctx.
|
|
1458
|
-
|
|
1459
|
-
ctx.
|
|
1460
|
-
ctx.beginPath();
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
const
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
ctx.
|
|
1476
|
-
ctx.
|
|
1477
|
-
ctx.
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
ctx.
|
|
1484
|
-
ctx.
|
|
1485
|
-
ctx.
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
ctx.
|
|
1496
|
-
ctx.
|
|
1497
|
-
ctx.
|
|
1498
|
-
ctx.
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
ctx.
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
ctx.
|
|
1529
|
-
ctx.
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
ctx.
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
ctx.
|
|
1544
|
-
ctx.
|
|
1545
|
-
ctx.
|
|
1546
|
-
ctx.
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
}
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
//
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
}
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
}
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
} else if (
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
if (e.code === "
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
if (!gameRunning && document.getElementById("finalScoreboard").classList.contains("visible") && (e.code === "Space" || e.code === "Enter")) {
|
|
1779
|
-
resetStartScreen();
|
|
1780
|
-
e.preventDefault();
|
|
1781
|
-
return;
|
|
1782
|
-
}
|
|
1783
|
-
|
|
1784
|
-
if (["Space", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(e.code)) {
|
|
1785
|
-
e.preventDefault();
|
|
1786
|
-
}
|
|
1787
|
-
});
|
|
1788
|
-
|
|
1789
|
-
document.getElementById("restartBtn").addEventListener("click", function() {
|
|
1790
|
-
document.getElementById("gameOverScreen").style.display = "none";
|
|
1791
|
-
resetStartScreen();
|
|
1792
|
-
});
|
|
1793
|
-
|
|
1794
|
-
// Initialize
|
|
1795
|
-
updateAllPrompts();
|
|
1796
|
-
initStars();
|
|
1797
|
-
gameLoop();
|
|
1798
|
-
</script>
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
<script id="page-helpers" src="/api/page-helpers.js?v=3" data-locked="true"></script><script id="page-script" src="/api/page-script.js?v=3" data-locked="true"></script></body></html>
|
|
1
|
+
<!DOCTYPE html><html lang="en"><head>
|
|
2
|
+
<meta charset="UTF-8">
|
|
3
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
4
|
+
<title>SynthOS</title>
|
|
5
|
+
<script id="theme-info" src="/api/theme-info.js" data-locked="true"></script>
|
|
6
|
+
<link id="theme-css" rel="stylesheet" href="/api/theme.css" data-locked="true">
|
|
7
|
+
<style>
|
|
8
|
+
#game-wrapper{width:100%;height:100%;display:flex;align-items:flex-start;justify-content:center;background:#000;overflow:hidden}
|
|
9
|
+
#game-container{position:relative;border:1px solid rgba(0,255,255,.25);box-shadow:0 0 24px rgba(0,255,255,.1),inset 0 0 24px rgba(0,255,255,.05);overflow:hidden;flex-shrink:0}
|
|
10
|
+
#gameCanvas{display:block;width:100%;height:100%}
|
|
11
|
+
.game-ui{position:absolute;top:20px;left:20px;right:20px;display:flex;justify-content:space-between;pointer-events:none;z-index:10}
|
|
12
|
+
.level-display,.lives-display,.score-display{font-family:Orbitron,'Segoe UI',sans-serif;font-size:18px;color:#0ff;text-shadow:0 0 10px #0ff,0 0 20px #0ff;letter-spacing:2px}
|
|
13
|
+
.mute-btn{pointer-events:auto;background:none;border:1px solid rgba(0,255,255,.4);border-radius:4px;color:#0ff;cursor:pointer;padding:2px 6px;font-size:16px;line-height:1;opacity:.7;transition:opacity .2s}.mute-btn:hover{opacity:1}
|
|
14
|
+
.player-indicator{font-family:Orbitron,'Segoe UI',sans-serif;font-size:18px;text-shadow:0 0 10px currentColor,0 0 20px currentColor;letter-spacing:2px;margin-right:8px}
|
|
15
|
+
.game-over-screen,.start-screen{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);text-align:center;z-index:20}
|
|
16
|
+
.game-over-screen h1,.start-screen h1{font-family:Orbitron,'Segoe UI',sans-serif;font-size:48px;line-height:1.2;color:#f0f;text-shadow:0 0 20px #f0f,0 0 40px #f0f,0 0 60px #f0f;margin-bottom:20px;letter-spacing:5px}
|
|
17
|
+
.game-over-screen p,.start-screen p{font-size:18px;color:#0ff;text-shadow:0 0 10px #0ff;margin-bottom:30px}
|
|
18
|
+
.restart-btn,.start-btn,.mode-btn{padding:15px 40px;font-size:18px;font-family:Orbitron,'Segoe UI',sans-serif;background:0 0;border:2px solid #0ff;color:#0ff;cursor:pointer;text-transform:uppercase;letter-spacing:3px;transition:.3s;box-shadow:0 0 20px rgba(0,255,255,.3),inset 0 0 20px rgba(0,255,255,.1)}
|
|
19
|
+
.restart-btn:hover,.start-btn:hover,.mode-btn:hover{background:rgba(0,255,255,.2);box-shadow:0 0 30px rgba(0,255,255,.5),inset 0 0 30px rgba(0,255,255,.2);transform:scale(1.05)}
|
|
20
|
+
.controls-info{position:absolute;bottom:16px;right:20px;font-size:13px;color:rgba(0,255,255,.5);text-align:right;letter-spacing:1px;display:flex;align-items:center;gap:16px;font-family:'Segoe UI',sans-serif}
|
|
21
|
+
.controls-info .action-item{display:inline-flex;align-items:center;gap:4px}
|
|
22
|
+
|
|
23
|
+
/* Mode selection */
|
|
24
|
+
.mode-select{display:flex;flex-direction:column;gap:12px;align-items:center;margin-bottom:20px}
|
|
25
|
+
.mode-btn{padding:12px 36px;font-size:16px;min-width:240px}
|
|
26
|
+
.mode-btn.selected{background:rgba(0,255,255,.25);border-color:#fff;color:#fff;box-shadow:0 0 30px rgba(0,255,255,.6),inset 0 0 20px rgba(0,255,255,.3)}
|
|
27
|
+
|
|
28
|
+
/* Player count selector */
|
|
29
|
+
.player-count-select{display:none;flex-direction:column;align-items:center;gap:12px;margin-top:16px}
|
|
30
|
+
.player-count-select.visible{display:flex}
|
|
31
|
+
.player-count-row{display:flex;align-items:center;gap:16px}
|
|
32
|
+
.player-count-arrow{font-size:28px;color:#0ff;cursor:pointer;user-select:none;text-shadow:0 0 10px #0ff;padding:4px 12px;transition:.2s}
|
|
33
|
+
.player-count-arrow:hover{color:#fff;text-shadow:0 0 15px #fff}
|
|
34
|
+
.player-count-num{font-family:Orbitron,'Segoe UI',sans-serif;font-size:36px;color:#f0f;text-shadow:0 0 15px #f0f,0 0 30px #f0f;min-width:50px;text-align:center}
|
|
35
|
+
.player-count-label{font-size:14px;color:rgba(0,255,255,.6);letter-spacing:2px}
|
|
36
|
+
.player-count-confirm{margin-top:8px}
|
|
37
|
+
|
|
38
|
+
/* Sub-mode selection */
|
|
39
|
+
.submode-select{display:none;flex-direction:column;align-items:center;gap:12px;margin-top:16px}
|
|
40
|
+
.submode-select.visible{display:flex}
|
|
41
|
+
.submode-title{font-family:Orbitron,'Segoe UI',sans-serif;font-size:14px;color:rgba(0,255,255,.7);letter-spacing:2px;margin-bottom:4px}
|
|
42
|
+
.submode-btn{padding:10px 30px;font-size:14px;min-width:220px;font-family:Orbitron,'Segoe UI',sans-serif;background:0 0;border:2px solid #0ff;color:#0ff;cursor:pointer;text-transform:uppercase;letter-spacing:2px;transition:.3s;box-shadow:0 0 15px rgba(0,255,255,.2),inset 0 0 15px rgba(0,255,255,.08)}
|
|
43
|
+
.submode-btn:hover{background:rgba(0,255,255,.2);box-shadow:0 0 25px rgba(0,255,255,.5);transform:scale(1.03)}
|
|
44
|
+
.submode-desc{font-size:11px;color:rgba(0,255,255,.45);font-family:'Segoe UI',sans-serif;max-width:280px;text-align:center;margin-top:-4px}
|
|
45
|
+
|
|
46
|
+
/* Side panels */
|
|
47
|
+
.side-panel{width:200px;flex-shrink:0;padding:20px 16px;display:flex;flex-direction:column;font-family:Orbitron,'Segoe UI',sans-serif;box-sizing:border-box;overflow:hidden}
|
|
48
|
+
.side-panel.hidden{display:none}
|
|
49
|
+
.side-panel h2{font-size:16px;letter-spacing:3px;margin:0 0 16px 0;text-align:center;font-weight:700}
|
|
50
|
+
#side-leaderboard{color:#f0f;text-shadow:0 0 10px #f0f,0 0 20px rgba(255,0,255,.4)}
|
|
51
|
+
#side-leaderboard h2{color:#f0f;text-shadow:0 0 10px #f0f,0 0 20px #f0f}
|
|
52
|
+
#side-controls{color:#0ff;text-shadow:0 0 10px #0ff,0 0 20px rgba(0,255,255,.4)}
|
|
53
|
+
#side-controls h2{color:#0ff;text-shadow:0 0 10px #0ff,0 0 20px #0ff}
|
|
54
|
+
.leaderboard-table{width:100%;border-collapse:collapse;font-family:'Courier New',monospace;font-size:13px}
|
|
55
|
+
.leaderboard-table td{padding:4px 0;white-space:nowrap}
|
|
56
|
+
.leaderboard-table .rank{width:24px;color:rgba(255,0,255,.6);text-align:right;padding-right:6px}
|
|
57
|
+
.leaderboard-table .initials{color:#f0f;letter-spacing:2px}
|
|
58
|
+
.leaderboard-table .hs-score{text-align:right;color:rgba(255,0,255,.7);position:relative;cursor:default}
|
|
59
|
+
.leaderboard-table .hs-score.overflow{animation:scoreFlash 0.8s ease-in-out infinite}
|
|
60
|
+
.leaderboard-table .hs-score[title]:hover::after{content:attr(title);position:absolute;right:0;top:-22px;background:#1a0028;color:#f0f;font-size:11px;padding:2px 6px;border:1px solid rgba(255,0,255,.4);border-radius:3px;white-space:nowrap;z-index:5;pointer-events:none}
|
|
61
|
+
@keyframes scoreFlash{0%,100%{opacity:1}50%{opacity:.4}}
|
|
62
|
+
.score-display .score-overflow{animation:hudScoreFlash 0.8s ease-in-out infinite}
|
|
63
|
+
@keyframes hudScoreFlash{0%,100%{color:#0ff;text-shadow:0 0 10px #0ff,0 0 20px #0ff}50%{color:#f0f;text-shadow:0 0 10px #f0f,0 0 20px #f0f}}
|
|
64
|
+
.controls-list{list-style:none;padding:0;margin:0;font-size:12px}
|
|
65
|
+
.controls-list li{padding:6px 0;display:flex;gap:8px;align-items:center;color:#0ff}
|
|
66
|
+
.controls-list .key-icon{display:inline-block;min-width:50px;padding:2px 6px;border:1px solid rgba(0,255,255,.4);border-radius:3px;text-align:center;font-size:11px;color:#0ff;background:rgba(0,255,255,.05);flex-shrink:0}
|
|
67
|
+
.controls-list .key-desc{color:rgba(0,255,255,.7);font-family:'Segoe UI',sans-serif}
|
|
68
|
+
.bt-section{margin-top:auto;padding-top:16px;border-top:1px solid rgba(0,255,255,.15)}
|
|
69
|
+
.bt-section h3{font-size:11px;letter-spacing:2px;color:rgba(0,255,255,.5);margin:0 0 8px 0;text-align:center;font-weight:400}
|
|
70
|
+
.bt-section p{font-size:11px;color:rgba(0,255,255,.4);font-family:'Segoe UI',sans-serif;margin:0 0 4px 0;line-height:1.4}
|
|
71
|
+
.side-panel{overflow-y:auto}
|
|
72
|
+
#side-leaderboard{padding-top:20px}
|
|
73
|
+
#side-controls{padding-top:20px}
|
|
74
|
+
|
|
75
|
+
/* Gamepad status indicator */
|
|
76
|
+
#gamepadStatus{text-align:center;padding:8px 0;margin-bottom:12px;font-size:11px;letter-spacing:2px;border:1px solid rgba(0,255,255,.15);border-radius:4px;transition:all .3s;color:rgba(0,255,255,.3);text-shadow:none}
|
|
77
|
+
#gamepadStatus.connected{color:#0f0;text-shadow:0 0 8px #0f0,0 0 16px rgba(0,255,0,.4);border-color:rgba(0,255,0,.3);background:rgba(0,255,0,.05);animation:gpPulse 2s ease-in-out infinite}
|
|
78
|
+
@keyframes gpPulse{0%,100%{box-shadow:0 0 4px rgba(0,255,0,.1)}50%{box-shadow:0 0 12px rgba(0,255,0,.25)}}
|
|
79
|
+
|
|
80
|
+
/* Pause overlay */
|
|
81
|
+
#pauseOverlay{position:absolute;top:0;left:0;right:0;bottom:0;display:none;align-items:center;justify-content:center;z-index:25;background:rgba(0,0,0,.5);flex-direction:column;gap:8px}
|
|
82
|
+
#pauseOverlay.visible{display:flex}
|
|
83
|
+
#pauseOverlay .pause-title{font-family:Orbitron,'Segoe UI',sans-serif;font-size:48px;color:#0ff;text-shadow:0 0 20px #0ff,0 0 40px #0ff,0 0 60px #0ff;letter-spacing:8px}
|
|
84
|
+
#pauseOverlay .pause-hint{font-family:'Segoe UI',sans-serif;font-size:14px;color:rgba(0,255,255,.5);letter-spacing:1px}
|
|
85
|
+
|
|
86
|
+
/* High score entry */
|
|
87
|
+
#highScoreEntry{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);text-align:center;z-index:30;display:none}
|
|
88
|
+
#highScoreEntry h2{font-family:Orbitron,'Segoe UI',sans-serif;font-size:24px;color:#f0f;text-shadow:0 0 15px #f0f,0 0 30px #f0f;margin-bottom:10px;letter-spacing:3px}
|
|
89
|
+
#highScoreEntry .hs-final-score{font-family:Orbitron,'Segoe UI',sans-serif;font-size:18px;color:#0ff;text-shadow:0 0 10px #0ff;margin-bottom:20px}
|
|
90
|
+
.initial-slots{display:flex;justify-content:center;gap:12px;margin-bottom:20px}
|
|
91
|
+
.initial-slot{width:40px;height:50px;border:2px solid #f0f;display:flex;align-items:center;justify-content:center;font-family:Orbitron,'Segoe UI',sans-serif;font-size:28px;color:#f0f;text-shadow:0 0 10px #f0f;box-shadow:0 0 10px rgba(255,0,255,.3)}
|
|
92
|
+
.initial-slot.active{border-color:#0ff;color:#0ff;text-shadow:0 0 10px #0ff;box-shadow:0 0 15px rgba(0,255,255,.5)}
|
|
93
|
+
.hs-instructions{font-size:12px;color:rgba(0,255,255,.6);font-family:'Segoe UI',sans-serif;margin-bottom:16px}
|
|
94
|
+
|
|
95
|
+
/* Keyboard key hint (for bottom bar) */
|
|
96
|
+
.kb-key{display:inline-block;padding:1px 6px;border:1px solid rgba(0,255,255,.35);border-radius:3px;font-size:11px;color:rgba(0,255,255,.7);background:rgba(0,255,255,.05);vertical-align:middle;margin:0 2px;font-family:'Segoe UI',sans-serif}
|
|
97
|
+
/* Focused menu item */
|
|
98
|
+
.mode-btn.focused,.submode-btn.focused{background:rgba(0,255,255,.2);border-color:#fff;color:#fff;box-shadow:0 0 25px rgba(0,255,255,.5),inset 0 0 20px rgba(0,255,255,.2)}
|
|
99
|
+
|
|
100
|
+
/* Turn ready overlay */
|
|
101
|
+
#turnReadyOverlay{position:absolute;top:0;left:0;right:0;bottom:0;display:none;align-items:center;justify-content:center;flex-direction:column;gap:12px;z-index:26;background:rgba(0,0,0,.7)}
|
|
102
|
+
#turnReadyOverlay.visible{display:flex}
|
|
103
|
+
#turnReadyOverlay .turn-player{font-family:Orbitron,'Segoe UI',sans-serif;font-size:42px;text-shadow:0 0 20px currentColor,0 0 40px currentColor;letter-spacing:6px}
|
|
104
|
+
#turnReadyOverlay .turn-subtitle{font-family:Orbitron,'Segoe UI',sans-serif;font-size:22px;color:#fff;text-shadow:0 0 12px rgba(255,255,255,.6);letter-spacing:4px;margin-bottom:8px}
|
|
105
|
+
#turnReadyOverlay .turn-prompt{font-family:'Segoe UI',sans-serif;font-size:16px;color:rgba(0,255,255,.6);letter-spacing:1px}
|
|
106
|
+
|
|
107
|
+
/* Final scoreboard overlay */
|
|
108
|
+
#finalScoreboard{position:absolute;top:0;left:0;right:0;bottom:0;display:none;align-items:center;justify-content:center;flex-direction:column;gap:16px;z-index:27;background:rgba(0,0,0,.8)}
|
|
109
|
+
#finalScoreboard.visible{display:flex}
|
|
110
|
+
#finalScoreboard .sb-title{font-family:Orbitron,'Segoe UI',sans-serif;font-size:32px;color:#f0f;text-shadow:0 0 20px #f0f,0 0 40px #f0f;letter-spacing:5px;margin-bottom:8px}
|
|
111
|
+
#finalScoreboard .sb-subtitle{font-family:Orbitron,'Segoe UI',sans-serif;font-size:14px;color:rgba(255,255,255,.5);letter-spacing:3px;margin-bottom:12px}
|
|
112
|
+
.sb-table{border-collapse:collapse;font-family:Orbitron,'Segoe UI',sans-serif;font-size:18px}
|
|
113
|
+
.sb-table td{padding:8px 16px}
|
|
114
|
+
.sb-table .sb-rank{color:rgba(255,255,255,.5);text-align:right;font-size:14px}
|
|
115
|
+
.sb-table .sb-player{letter-spacing:3px}
|
|
116
|
+
.sb-table .sb-initials{font-size:14px;color:rgba(255,255,255,.5);letter-spacing:2px}
|
|
117
|
+
.sb-table .sb-score{text-align:right;color:#fff;letter-spacing:2px}
|
|
118
|
+
.sb-play-again{margin-top:16px}
|
|
119
|
+
</style>
|
|
120
|
+
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap" rel="stylesheet">
|
|
121
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
|
122
|
+
</head>
|
|
123
|
+
|
|
124
|
+
<body>
|
|
125
|
+
<div class="viewer-panel full-viewer" id="viewerPanel" style="background:#000;">
|
|
126
|
+
<div id="game-wrapper">
|
|
127
|
+
<div id="side-leaderboard" class="side-panel hidden">
|
|
128
|
+
<h2>HIGH SCORES</h2>
|
|
129
|
+
<table class="leaderboard-table">
|
|
130
|
+
<tbody id="leaderboardBody"></tbody>
|
|
131
|
+
</table>
|
|
132
|
+
</div>
|
|
133
|
+
<div id="game-container">
|
|
134
|
+
<canvas id="gameCanvas"></canvas>
|
|
135
|
+
<div class="game-ui">
|
|
136
|
+
<div class="score-display"><span id="playerIndicator" class="player-indicator" style="display:none"></span>SCORE: <span id="score">00000</span></div>
|
|
137
|
+
<div class="level-display">LEVEL: <span id="level">1</span></div>
|
|
138
|
+
<div class="lives-display">LIVES: <span id="lives">3</span></div>
|
|
139
|
+
<button class="mute-btn" id="muteBtn" title="Toggle sound">🔊</button>
|
|
140
|
+
</div>
|
|
141
|
+
<div id="pauseOverlay"><span class="pause-title">PAUSED</span><span class="pause-hint" id="pauseHint"></span></div>
|
|
142
|
+
<div id="turnReadyOverlay">
|
|
143
|
+
<div class="turn-player" id="turnPlayerName">PLAYER 1</div>
|
|
144
|
+
<div class="turn-subtitle">YOUR TURN</div>
|
|
145
|
+
<div class="turn-prompt" id="turnPrompt">Press SPACE to start</div>
|
|
146
|
+
</div>
|
|
147
|
+
<div id="finalScoreboard">
|
|
148
|
+
<div class="sb-title">GAME OVER</div>
|
|
149
|
+
<div class="sb-subtitle" id="sbSubtitle">FINAL STANDINGS</div>
|
|
150
|
+
<table class="sb-table"><tbody id="sbBody"></tbody></table>
|
|
151
|
+
<button class="restart-btn sb-play-again" id="sbPlayAgain">PLAY AGAIN</button>
|
|
152
|
+
</div>
|
|
153
|
+
<div class="start-screen" id="startScreen">
|
|
154
|
+
<h1>NEON<br>ASTEROIDS</h1>
|
|
155
|
+
<p>Navigate the cosmic void. Destroy all asteroids. Beware the saucers!</p>
|
|
156
|
+
<div class="mode-select" id="modeSelect">
|
|
157
|
+
<button class="mode-btn" id="btn1P">START MISSION</button>
|
|
158
|
+
<button class="mode-btn" id="btnPassPlay">PASS & PLAY</button>
|
|
159
|
+
</div>
|
|
160
|
+
<div class="submode-select" id="submodeSelect">
|
|
161
|
+
<div class="submode-title">CHOOSE MODE</div>
|
|
162
|
+
<button class="submode-btn" id="btnSoloTurns">SOLO TURNS</button>
|
|
163
|
+
<div class="submode-desc">Each player gets a fresh game. Highest total score wins.</div>
|
|
164
|
+
<button class="submode-btn" id="btnHotSeat">HOT SEAT</button>
|
|
165
|
+
<div class="submode-desc">Shared asteroid field. Rotate on each death. Last one standing!</div>
|
|
166
|
+
</div>
|
|
167
|
+
<div class="player-count-select" id="playerCountSelect">
|
|
168
|
+
<div class="player-count-label">PLAYERS</div>
|
|
169
|
+
<div class="player-count-row">
|
|
170
|
+
<span class="player-count-arrow" id="pcLeft">←</span>
|
|
171
|
+
<span class="player-count-num" id="pcNum">2</span>
|
|
172
|
+
<span class="player-count-arrow" id="pcRight">→</span>
|
|
173
|
+
</div>
|
|
174
|
+
<button class="mode-btn player-count-confirm" id="pcConfirm">START</button>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
<div class="game-over-screen" id="gameOverScreen" style="display: none;">
|
|
178
|
+
<h1>GAME OVER</h1>
|
|
179
|
+
<p>Final Score: <span id="finalScore">0</span></p>
|
|
180
|
+
<button class="restart-btn" id="restartBtn">TRY AGAIN</button>
|
|
181
|
+
</div>
|
|
182
|
+
<div id="highScoreEntry">
|
|
183
|
+
<h2>NEW HIGH SCORE!</h2>
|
|
184
|
+
<div class="hs-final-score">SCORE: <span id="hsScore">0</span></div>
|
|
185
|
+
<div class="initial-slots">
|
|
186
|
+
<div class="initial-slot active" id="slot0">A</div>
|
|
187
|
+
<div class="initial-slot" id="slot1">A</div>
|
|
188
|
+
<div class="initial-slot" id="slot2">A</div>
|
|
189
|
+
</div>
|
|
190
|
+
<div class="hs-instructions" id="hsInstructions">LEFT/RIGHT select slot • UP/DOWN change letter • ENTER confirm</div>
|
|
191
|
+
</div>
|
|
192
|
+
<div class="controls-info" id="controlsInfo">WASD / ARROWS to move • SPACE to fire • H hyperspace • P pause</div>
|
|
193
|
+
</div>
|
|
194
|
+
<div id="side-controls" class="side-panel hidden">
|
|
195
|
+
<div id="gamepadStatus">NO GAMEPAD</div>
|
|
196
|
+
<h2>CONTROLS</h2>
|
|
197
|
+
<ul class="controls-list" id="controlsList">
|
|
198
|
+
<li><span class="key-icon">W/↑</span><span class="key-desc">Thrust</span></li>
|
|
199
|
+
<li><span class="key-icon">A/←</span><span class="key-desc">Rotate Left</span></li>
|
|
200
|
+
<li><span class="key-icon">D/→</span><span class="key-desc">Rotate Right</span></li>
|
|
201
|
+
<li><span class="key-icon">SPACE</span><span class="key-desc">Fire</span></li>
|
|
202
|
+
<li><span class="key-icon">H</span><span class="key-desc">Hyperspace</span></li>
|
|
203
|
+
<li><span class="key-icon">P</span><span class="key-desc">Pause</span></li>
|
|
204
|
+
</ul>
|
|
205
|
+
<h2 style="margin-top:24px">POWER-UPS</h2>
|
|
206
|
+
<ul class="controls-list">
|
|
207
|
+
<li><span class="key-icon" style="color:#0ff;border-color:rgba(0,255,255,.4)">S</span><span class="key-desc">Shield</span></li>
|
|
208
|
+
<li><span class="key-icon" style="color:#f00;border-color:rgba(255,0,0,.4)">R</span><span class="key-desc">Rapid Fire</span></li>
|
|
209
|
+
<li><span class="key-icon" style="color:#ff0;border-color:rgba(255,255,0,.4)">M</span><span class="key-desc">Multi-Shot</span></li>
|
|
210
|
+
<li><span class="key-icon" style="color:#0f0;border-color:rgba(0,255,0,.4)">+</span><span class="key-desc">Extra Life</span></li>
|
|
211
|
+
</ul>
|
|
212
|
+
<div class="bt-section" id="btSection"></div>
|
|
213
|
+
</div>
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
</div>
|
|
217
|
+
<div id="instructions" style="display: none;" data-locked="true"></div>
|
|
218
|
+
<div id="thoughts" style="display: none;" data-locked="true"></div>
|
|
219
|
+
<script src="/static/retro-game.js"></script>
|
|
220
|
+
<script id="asteroids-game">
|
|
221
|
+
RetroGame.injectCSS();
|
|
222
|
+
|
|
223
|
+
// --- Sound Effects ---
|
|
224
|
+
var sfx = RetroGame.createSoundEffects();
|
|
225
|
+
var sfxReady = false;
|
|
226
|
+
sfx.load().then(function() {
|
|
227
|
+
console.log('✓ Sound effects loaded successfully');
|
|
228
|
+
sfxReady = true;
|
|
229
|
+
}).catch(function(e) {
|
|
230
|
+
console.error('✗ Sound effects failed to load:', e);
|
|
231
|
+
console.error('Make sure effects.json exists in page file storage');
|
|
232
|
+
console.error('Upload it via: synthos.files.upload("effects.json", blob)');
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
// Mute toggle
|
|
236
|
+
var sfxMuted = false;
|
|
237
|
+
document.getElementById("muteBtn").addEventListener("click", function() {
|
|
238
|
+
sfxMuted = !sfxMuted;
|
|
239
|
+
sfx.volume = sfxMuted ? 0 : 1;
|
|
240
|
+
this.innerHTML = sfxMuted ? "\u{1F507}" : "\u{1F50A}";
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
var ambientPlaying = false;
|
|
244
|
+
var ambientTimeout = null;
|
|
245
|
+
var AMBIENT_TRACKS = ['Ambient_Space', 'Ambient_Space2', 'Ambient_Space3'];
|
|
246
|
+
var currentAmbientIndex = -1;
|
|
247
|
+
|
|
248
|
+
function startAmbient() {
|
|
249
|
+
if (ambientPlaying) return;
|
|
250
|
+
ambientPlaying = true;
|
|
251
|
+
playNextAmbient();
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function playNextAmbient() {
|
|
255
|
+
if (!ambientPlaying || !sfxReady) return;
|
|
256
|
+
// Pick a random track different from the last one
|
|
257
|
+
let idx;
|
|
258
|
+
do { idx = Math.floor(Math.random() * AMBIENT_TRACKS.length); } while (idx === currentAmbientIndex && AMBIENT_TRACKS.length > 1);
|
|
259
|
+
currentAmbientIndex = idx;
|
|
260
|
+
sfx.play(AMBIENT_TRACKS[idx]);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function stopAmbient() {
|
|
264
|
+
ambientPlaying = false;
|
|
265
|
+
if (ambientTimeout) { clearTimeout(ambientTimeout); ambientTimeout = null; }
|
|
266
|
+
if (sfxReady) AMBIENT_TRACKS.forEach(function(t) { sfx.stop(t); });
|
|
267
|
+
currentAmbientIndex = -1;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
var canvas = document.getElementById("gameCanvas");
|
|
271
|
+
var ctx = canvas.getContext("2d");
|
|
272
|
+
var viewerPanel = document.getElementById("viewerPanel");
|
|
273
|
+
var gameContainer = document.getElementById("game-container");
|
|
274
|
+
var sideLeaderboard = document.getElementById("side-leaderboard");
|
|
275
|
+
var sideControls = document.getElementById("side-controls");
|
|
276
|
+
var pauseOverlay = document.getElementById("pauseOverlay");
|
|
277
|
+
var ASPECT = 4 / 3;
|
|
278
|
+
var MAX_SCORE = 99999;
|
|
279
|
+
|
|
280
|
+
// Player colors: P1=cyan, P2=magenta, P3=yellow, P4=green
|
|
281
|
+
var PLAYER_COLORS = ["#00ffff", "#ff00ff", "#ffff00", "#00ff00", "#ff6600", "#ff3388", "#33ccff", "#ccff33"];
|
|
282
|
+
|
|
283
|
+
var resizeTimer = 0;
|
|
284
|
+
|
|
285
|
+
function resizeCanvas() {
|
|
286
|
+
const vw = viewerPanel.clientWidth;
|
|
287
|
+
const vh = viewerPanel.clientHeight;
|
|
288
|
+
if (vw < 1 || vh < 1) return;
|
|
289
|
+
const panelRatio = vw / vh;
|
|
290
|
+
let w, h;
|
|
291
|
+
if (panelRatio > ASPECT) {
|
|
292
|
+
h = vh;
|
|
293
|
+
w = Math.floor(h * ASPECT);
|
|
294
|
+
} else {
|
|
295
|
+
w = vw;
|
|
296
|
+
h = Math.floor(w / ASPECT);
|
|
297
|
+
}
|
|
298
|
+
gameContainer.style.width = w + "px";
|
|
299
|
+
gameContainer.style.height = h + "px";
|
|
300
|
+
canvas.width = w;
|
|
301
|
+
canvas.height = h;
|
|
302
|
+
const extraSpace = vw - w;
|
|
303
|
+
if (extraSpace > 400) {
|
|
304
|
+
sideLeaderboard.classList.remove("hidden");
|
|
305
|
+
sideControls.classList.remove("hidden");
|
|
306
|
+
} else {
|
|
307
|
+
sideLeaderboard.classList.add("hidden");
|
|
308
|
+
sideControls.classList.add("hidden");
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function debouncedResize() {
|
|
313
|
+
clearTimeout(resizeTimer);
|
|
314
|
+
resizeCanvas();
|
|
315
|
+
resizeTimer = setTimeout(resizeCanvas, 300);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
resizeCanvas();
|
|
319
|
+
window.addEventListener("resize", resizeCanvas);
|
|
320
|
+
new MutationObserver(debouncedResize).observe(document.body, { attributes: true, attributeFilter: ["class"] });
|
|
321
|
+
|
|
322
|
+
// --- Gamepad input (library) ---
|
|
323
|
+
var gamepad = RetroGame.createGamepad({ deadzone: 0.3 });
|
|
324
|
+
var B = RetroGame.BUTTON;
|
|
325
|
+
var gamepadUI = RetroGame.createGamepadUI(gamepad, { statusElement: document.getElementById("gamepadStatus") });
|
|
326
|
+
|
|
327
|
+
// Game-specific gamepad action mappings
|
|
328
|
+
function gpFire() { return gamepad.isDown(B.A) || gamepad.isDown(B.X) || gamepad.isDown(B.RB) || gamepad.isDown(B.RT); }
|
|
329
|
+
function gpHyper() { return gamepad.wasPressed(B.B) || gamepad.wasPressed(B.LB); }
|
|
330
|
+
function gpPause() { return gamepad.wasPressed(B.START); }
|
|
331
|
+
function gpConfirm() { return gamepad.wasPressed(B.A); }
|
|
332
|
+
function gpBack() { return gamepad.wasPressed(B.B); }
|
|
333
|
+
|
|
334
|
+
// Edge-triggered directional helpers (stick + dpad)
|
|
335
|
+
// Track previous directional state for stick-based edge detection
|
|
336
|
+
var _prevDir = { up: false, down: false, left: false, right: false };
|
|
337
|
+
function gpUp() { var r = gamepad.up && !_prevDir.up; return r; }
|
|
338
|
+
function gpDown() { var r = gamepad.down && !_prevDir.down; return r; }
|
|
339
|
+
function gpLeft() { var r = gamepad.left && !_prevDir.left; return r; }
|
|
340
|
+
function gpRight() { var r = gamepad.right && !_prevDir.right; return r; }
|
|
341
|
+
function saveDirState() { _prevDir.up = gamepad.up; _prevDir.down = gamepad.down; _prevDir.left = gamepad.left; _prevDir.right = gamepad.right; }
|
|
342
|
+
|
|
343
|
+
// Delegate to library UI
|
|
344
|
+
function gpBtn(name) { return gamepadUI.buttonGlyph(name); }
|
|
345
|
+
function gpBtnName(name) { return gamepadUI.buttonName(name); }
|
|
346
|
+
function gpStartName() { return gamepadUI.startName(); }
|
|
347
|
+
|
|
348
|
+
// Returns styled HTML for a non-face button label (game-specific, not in library)
|
|
349
|
+
function gpLabel(text) {
|
|
350
|
+
return '<span class="gp-label">' + text + '</span>';
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// --- Gamepad-aware text helper ---
|
|
354
|
+
function btnText(kbLabel, gpLabelText) {
|
|
355
|
+
return gamepad.connected ? gpLabelText : kbLabel;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// Keyboard key styled span
|
|
359
|
+
function kbKey(text) {
|
|
360
|
+
return '<span class="kb-key">' + text + '</span>';
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// Build an action item for the bottom bar
|
|
364
|
+
function actionItem(hint, label) {
|
|
365
|
+
return '<span class="action-item">' + hint + ' ' + label + '</span>';
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// --- Unified bottom bar: menu nav OR game controls ---
|
|
369
|
+
function updateBottomBar() {
|
|
370
|
+
var bar = document.getElementById("controlsInfo");
|
|
371
|
+
var startVisible = document.getElementById("startScreen").style.display !== "none";
|
|
372
|
+
var gameOverVisible = document.getElementById("gameOverScreen").style.display === "block";
|
|
373
|
+
var scoreboardVisible = document.getElementById("finalScoreboard").classList.contains("visible");
|
|
374
|
+
|
|
375
|
+
// Menu screens — show navigation hints
|
|
376
|
+
if (startVisible) {
|
|
377
|
+
if (gamepad.connected) {
|
|
378
|
+
if (startScreenPhase === "mode") {
|
|
379
|
+
bar.innerHTML =
|
|
380
|
+
actionItem(gpLabel("\u2191\u2193"), "Navigate") +
|
|
381
|
+
actionItem(gpBtn("a"), "Select");
|
|
382
|
+
} else if (startScreenPhase === "submode") {
|
|
383
|
+
bar.innerHTML =
|
|
384
|
+
actionItem(gpLabel("\u2191\u2193"), "Navigate") +
|
|
385
|
+
actionItem(gpBtn("a"), "Select") +
|
|
386
|
+
actionItem(gpBtn("b"), "Back");
|
|
387
|
+
} else if (startScreenPhase === "count") {
|
|
388
|
+
bar.innerHTML =
|
|
389
|
+
actionItem(gpLabel("\u2190\u2192"), "Players") +
|
|
390
|
+
actionItem(gpBtn("a"), "Start") +
|
|
391
|
+
actionItem(gpBtn("b"), "Back");
|
|
392
|
+
}
|
|
393
|
+
} else {
|
|
394
|
+
if (startScreenPhase === "mode") {
|
|
395
|
+
bar.innerHTML =
|
|
396
|
+
actionItem(kbKey("\u2191\u2193"), "Navigate") +
|
|
397
|
+
actionItem(kbKey("ENTER"), "Select");
|
|
398
|
+
} else if (startScreenPhase === "submode") {
|
|
399
|
+
bar.innerHTML =
|
|
400
|
+
actionItem(kbKey("\u2191\u2193"), "Navigate") +
|
|
401
|
+
actionItem(kbKey("ENTER"), "Select") +
|
|
402
|
+
actionItem(kbKey("ESC"), "Back");
|
|
403
|
+
} else if (startScreenPhase === "count") {
|
|
404
|
+
bar.innerHTML =
|
|
405
|
+
actionItem(kbKey("\u2190\u2192"), "Players") +
|
|
406
|
+
actionItem(kbKey("ENTER"), "Start") +
|
|
407
|
+
actionItem(kbKey("ESC"), "Back");
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// High score entry
|
|
414
|
+
if (hsEntryActive) {
|
|
415
|
+
if (gamepad.connected) {
|
|
416
|
+
bar.innerHTML =
|
|
417
|
+
actionItem(gpLabel("\u2191\u2193"), "Letter") +
|
|
418
|
+
actionItem(gpBtn("a"), "Next") +
|
|
419
|
+
actionItem(gpBtn("b"), "Back");
|
|
420
|
+
} else {
|
|
421
|
+
bar.innerHTML =
|
|
422
|
+
actionItem(kbKey("\u2191\u2193"), "Letter") +
|
|
423
|
+
actionItem(kbKey("\u2190\u2192"), "Slot") +
|
|
424
|
+
actionItem(kbKey("ENTER"), "Confirm");
|
|
425
|
+
}
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// Game over / scoreboard
|
|
430
|
+
if (gameOverVisible || scoreboardVisible) {
|
|
431
|
+
if (gamepad.connected) {
|
|
432
|
+
bar.innerHTML = actionItem(gpBtn("a"), "Continue");
|
|
433
|
+
} else {
|
|
434
|
+
bar.innerHTML = actionItem(kbKey("ENTER"), "Continue");
|
|
435
|
+
}
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
// In-game controls
|
|
440
|
+
if (gamepad.connected) {
|
|
441
|
+
bar.innerHTML =
|
|
442
|
+
actionItem(gpLabel("L-Stick"), "Move") +
|
|
443
|
+
actionItem(gpBtn("a"), "Fire") +
|
|
444
|
+
actionItem(gpBtn("b"), "Hyperspace") +
|
|
445
|
+
actionItem(gpLabel(gpStartName()), "Pause");
|
|
446
|
+
} else {
|
|
447
|
+
bar.innerHTML =
|
|
448
|
+
actionItem(kbKey("WASD"), "Move") +
|
|
449
|
+
actionItem(kbKey("SPACE"), "Fire") +
|
|
450
|
+
actionItem(kbKey("H"), "Hyperspace") +
|
|
451
|
+
actionItem(kbKey("P"), "Pause");
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
function updateAllPrompts() {
|
|
456
|
+
// Start screen buttons
|
|
457
|
+
document.getElementById("btn1P").textContent = gamepad.connected ? "1 PLAYER" : "START MISSION";
|
|
458
|
+
document.getElementById("btnPassPlay").textContent = "PASS & PLAY";
|
|
459
|
+
document.getElementById("btnSoloTurns").textContent = "SOLO TURNS";
|
|
460
|
+
document.getElementById("btnHotSeat").textContent = "HOT SEAT";
|
|
461
|
+
// Focus highlight
|
|
462
|
+
updateMenuFocus();
|
|
463
|
+
// Restart button
|
|
464
|
+
var restartBtn = document.getElementById("restartBtn");
|
|
465
|
+
if (gamepad.connected) {
|
|
466
|
+
restartBtn.innerHTML = gpBtn("a") + ' RETRY';
|
|
467
|
+
} else {
|
|
468
|
+
restartBtn.textContent = "TRY AGAIN";
|
|
469
|
+
}
|
|
470
|
+
// HS instructions
|
|
471
|
+
document.getElementById("hsInstructions").innerHTML = btnText(
|
|
472
|
+
"LEFT/RIGHT select slot • UP/DOWN change letter • ENTER confirm",
|
|
473
|
+
gpLabel("\u2191\u2193") + " change letter • " + gpBtn("a") + " next • " + gpBtn("b") + " back"
|
|
474
|
+
);
|
|
475
|
+
// Pause hint
|
|
476
|
+
document.getElementById("pauseHint").innerHTML = btnText(
|
|
477
|
+
"P to resume",
|
|
478
|
+
gpLabel(gpStartName()) + " to resume"
|
|
479
|
+
);
|
|
480
|
+
// Turn ready prompt
|
|
481
|
+
document.getElementById("turnPrompt").innerHTML = btnText(
|
|
482
|
+
"Press SPACE to start",
|
|
483
|
+
"Press " + gpBtn("a") + " to start"
|
|
484
|
+
);
|
|
485
|
+
// Player count confirm
|
|
486
|
+
var pcConfirm = document.getElementById("pcConfirm");
|
|
487
|
+
if (gamepad.connected) {
|
|
488
|
+
pcConfirm.innerHTML = gpBtn("a") + ' START';
|
|
489
|
+
} else {
|
|
490
|
+
pcConfirm.textContent = "START";
|
|
491
|
+
}
|
|
492
|
+
// Scoreboard play again
|
|
493
|
+
var sbBtn = document.getElementById("sbPlayAgain");
|
|
494
|
+
if (gamepad.connected) {
|
|
495
|
+
sbBtn.innerHTML = gpBtn("a") + ' PLAY AGAIN';
|
|
496
|
+
} else {
|
|
497
|
+
sbBtn.textContent = "PLAY AGAIN";
|
|
498
|
+
}
|
|
499
|
+
// Bottom bar
|
|
500
|
+
updateBottomBar();
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
// --- High Score System (synthos.data, top 20) ---
|
|
504
|
+
var MAX_LEADERBOARD = 20;
|
|
505
|
+
var _highScores = [{ initials: "ACE", score: 10000 }];
|
|
506
|
+
|
|
507
|
+
// Load scores from app table storage on startup
|
|
508
|
+
(async function() {
|
|
509
|
+
try {
|
|
510
|
+
var row = await synthos.data.get('high_scores', 'scores');
|
|
511
|
+
if (row && Array.isArray(row.entries) && row.entries.length > 0) {
|
|
512
|
+
_highScores = row.entries;
|
|
513
|
+
}
|
|
514
|
+
} catch(e) {}
|
|
515
|
+
renderLeaderboard();
|
|
516
|
+
})();
|
|
517
|
+
|
|
518
|
+
function loadHighScores() {
|
|
519
|
+
return _highScores;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
function saveHighScores(scores) {
|
|
523
|
+
_highScores = scores;
|
|
524
|
+
synthos.data.save('high_scores', { id: 'scores', entries: scores }).catch(function() {});
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
function qualifiesForHighScore(s) {
|
|
528
|
+
var scores = loadHighScores();
|
|
529
|
+
return scores.length < MAX_LEADERBOARD || s > scores[scores.length - 1].score;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
function insertHighScore(initials, s) {
|
|
533
|
+
var scores = loadHighScores().slice();
|
|
534
|
+
scores.push({ initials: initials, score: s });
|
|
535
|
+
scores.sort(function(a, b) { return b.score - a.score; });
|
|
536
|
+
if (scores.length > MAX_LEADERBOARD) scores.length = MAX_LEADERBOARD;
|
|
537
|
+
saveHighScores(scores);
|
|
538
|
+
renderLeaderboard();
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
function formatLeaderboardScore(s) {
|
|
542
|
+
if (s > MAX_SCORE) {
|
|
543
|
+
return { text: "99,999+", overflow: true };
|
|
544
|
+
}
|
|
545
|
+
return { text: s.toLocaleString(), overflow: false };
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
function renderLeaderboard() {
|
|
549
|
+
var scores = loadHighScores();
|
|
550
|
+
var tbody = document.getElementById("leaderboardBody");
|
|
551
|
+
tbody.innerHTML = "";
|
|
552
|
+
scores.forEach(function(entry, i) {
|
|
553
|
+
var tr = document.createElement("tr");
|
|
554
|
+
var fmt = formatLeaderboardScore(entry.score);
|
|
555
|
+
var overflowClass = fmt.overflow ? " overflow" : "";
|
|
556
|
+
var titleAttr = fmt.overflow ? ' title="' + entry.score.toLocaleString() + '"' : "";
|
|
557
|
+
tr.innerHTML =
|
|
558
|
+
'<td class="rank">' + (i + 1) + '.</td>' +
|
|
559
|
+
'<td class="initials">' + entry.initials + '</td>' +
|
|
560
|
+
'<td class="hs-score' + overflowClass + '"' + titleAttr + '>' + fmt.text + '</td>';
|
|
561
|
+
tbody.appendChild(tr);
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
renderLeaderboard();
|
|
566
|
+
|
|
567
|
+
// --- BT Controller Instructions (platform-aware) ---
|
|
568
|
+
(function() {
|
|
569
|
+
const el = document.getElementById("btSection");
|
|
570
|
+
const isMac = /Mac|iPhone|iPad/.test(navigator.platform) || /Macintosh/.test(navigator.userAgent);
|
|
571
|
+
if (isMac) {
|
|
572
|
+
el.innerHTML =
|
|
573
|
+
'<h3>GAMEPAD</h3>' +
|
|
574
|
+
'<p>1. Put controller in pairing mode</p>' +
|
|
575
|
+
'<p>2. Open <b>System Settings > Bluetooth</b></p>' +
|
|
576
|
+
'<p>3. Find controller in list, click <b>Connect</b></p>' +
|
|
577
|
+
'<p>4. Reload page once paired</p>';
|
|
578
|
+
} else {
|
|
579
|
+
el.innerHTML =
|
|
580
|
+
'<h3>GAMEPAD</h3>' +
|
|
581
|
+
'<p>1. Put controller in pairing mode</p>' +
|
|
582
|
+
'<p>2. Open <b>Settings > Bluetooth & devices</b></p>' +
|
|
583
|
+
'<p>3. Click <b>Add device > Bluetooth</b></p>' +
|
|
584
|
+
'<p>4. Select controller, then reload page</p>';
|
|
585
|
+
}
|
|
586
|
+
})();
|
|
587
|
+
|
|
588
|
+
// --- Gamepad Detection & Controls Swap ---
|
|
589
|
+
var KEYBOARD_CONTROLS = '<li><span class="key-icon">W/\u2191</span><span class="key-desc">Thrust</span></li>' +
|
|
590
|
+
'<li><span class="key-icon">A/\u2190</span><span class="key-desc">Rotate Left</span></li>' +
|
|
591
|
+
'<li><span class="key-icon">D/\u2192</span><span class="key-desc">Rotate Right</span></li>' +
|
|
592
|
+
'<li><span class="key-icon">SPACE</span><span class="key-desc">Fire</span></li>' +
|
|
593
|
+
'<li><span class="key-icon">H</span><span class="key-desc">Hyperspace</span></li>' +
|
|
594
|
+
'<li><span class="key-icon">P</span><span class="key-desc">Pause</span></li>';
|
|
595
|
+
|
|
596
|
+
function buildGamepadControls() {
|
|
597
|
+
return '<li><span class="key-icon">L-Stick</span><span class="key-desc">Thrust / Rotate</span></li>' +
|
|
598
|
+
'<li><span class="key-icon">D-Pad</span><span class="key-desc">Thrust / Rotate</span></li>' +
|
|
599
|
+
'<li><span class="key-icon">' + gpBtnName("a") + ' / RB</span><span class="key-desc">Fire</span></li>' +
|
|
600
|
+
'<li><span class="key-icon">' + gpBtnName("b") + ' / LB</span><span class="key-desc">Hyperspace</span></li>' +
|
|
601
|
+
'<li><span class="key-icon">' + gpStartName() + '</span><span class="key-desc">Pause</span></li>';
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
function refreshGamepadUI() {
|
|
605
|
+
gamepadUI.update();
|
|
606
|
+
var listEl = document.getElementById("controlsList");
|
|
607
|
+
var btEl = document.getElementById("btSection");
|
|
608
|
+
if (gamepad.connected) {
|
|
609
|
+
listEl.innerHTML = buildGamepadControls();
|
|
610
|
+
btEl.style.display = "none";
|
|
611
|
+
} else {
|
|
612
|
+
listEl.innerHTML = KEYBOARD_CONTROLS;
|
|
613
|
+
btEl.style.display = "";
|
|
614
|
+
}
|
|
615
|
+
updateAllPrompts();
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
gamepad.onConnect = function() { refreshGamepadUI(); };
|
|
619
|
+
gamepad.onDisconnect = function() { refreshGamepadUI(); };
|
|
620
|
+
|
|
621
|
+
// --- Game Mode State ---
|
|
622
|
+
var gameMode = "single"; // "single", "solo_turns", "hot_seat"
|
|
623
|
+
var playerCount = 2;
|
|
624
|
+
var currentPlayer = 0;
|
|
625
|
+
var players = []; // {score, lives, level, alive, initials}
|
|
626
|
+
var turnReady = false;
|
|
627
|
+
var startScreenPhase = "mode"; // "mode", "submode", "count"
|
|
628
|
+
|
|
629
|
+
// --- Game State ---
|
|
630
|
+
var gameRunning = false, gamePaused = false, score = 0, lives = 3, level = 1;
|
|
631
|
+
var shake = RetroGame.createShake();
|
|
632
|
+
var hyperspaceCooldown = 0;
|
|
633
|
+
var hyperspaceInvincible = 0;
|
|
634
|
+
|
|
635
|
+
var ship = {
|
|
636
|
+
x: 0, y: 0, vx: 0, vy: 0, angle: -Math.PI / 2,
|
|
637
|
+
radius: 15, thrust: 0, rotationSpeed: 0,
|
|
638
|
+
invincible: 0, shield: 0, rapidFire: 0, multiShot: 0
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
var bullets = [], asteroids = [], powerUps = [], stars = [];
|
|
642
|
+
var saucers = [], saucerBullets = [], saucerSpawnTimer = 0;
|
|
643
|
+
var keyboard = RetroGame.createKeyboard();
|
|
644
|
+
var particles = RetroGame.createParticles({ maxParticles: 500 });
|
|
645
|
+
|
|
646
|
+
// --- High Score Entry State ---
|
|
647
|
+
var hsEntryActive = false;
|
|
648
|
+
var hsSlots = [0, 0, 0];
|
|
649
|
+
var hsActiveSlot = 0;
|
|
650
|
+
var hsFinalScore = 0;
|
|
651
|
+
var hsEntryPlayerIndex = -1; // track which player is entering HS in multiplayer
|
|
652
|
+
|
|
653
|
+
function getActivePlayerColor() {
|
|
654
|
+
if (gameMode === "single") return PLAYER_COLORS[0];
|
|
655
|
+
return PLAYER_COLORS[currentPlayer] || PLAYER_COLORS[0];
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
function initStars() {
|
|
659
|
+
stars = [];
|
|
660
|
+
for (let i = 0; i < 150; i++)
|
|
661
|
+
stars.push({
|
|
662
|
+
x: Math.random() * canvas.width,
|
|
663
|
+
y: Math.random() * canvas.height,
|
|
664
|
+
size: 2 * Math.random() + 0.5,
|
|
665
|
+
speed: 0.5 * Math.random() + 0.1,
|
|
666
|
+
brightness: Math.random()
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
function initGame() {
|
|
671
|
+
ship.x = canvas.width / 2;
|
|
672
|
+
ship.y = canvas.height / 2;
|
|
673
|
+
ship.vx = 0; ship.vy = 0;
|
|
674
|
+
ship.angle = -Math.PI / 2;
|
|
675
|
+
ship.invincible = 180;
|
|
676
|
+
ship.shield = 0; ship.rapidFire = 0; ship.multiShot = 0;
|
|
677
|
+
bullets = []; asteroids = []; powerUps = [];
|
|
678
|
+
particles.clear();
|
|
679
|
+
saucers = []; saucerBullets = []; saucerSpawnTimer = 0;
|
|
680
|
+
hyperspaceCooldown = 0; hyperspaceInvincible = 0;
|
|
681
|
+
score = 0; lives = 3; level = 1;
|
|
682
|
+
initStars();
|
|
683
|
+
spawnAsteroids(4);
|
|
684
|
+
updateUI();
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
// Init game for hot seat (preserves asteroids/level across player swaps)
|
|
688
|
+
function initHotSeatRespawn() {
|
|
689
|
+
ship.x = canvas.width / 2;
|
|
690
|
+
ship.y = canvas.height / 2;
|
|
691
|
+
ship.vx = 0; ship.vy = 0;
|
|
692
|
+
ship.angle = -Math.PI / 2;
|
|
693
|
+
ship.invincible = 180;
|
|
694
|
+
ship.shield = 0; ship.rapidFire = 0; ship.multiShot = 0;
|
|
695
|
+
bullets = [];
|
|
696
|
+
saucerBullets = [];
|
|
697
|
+
hyperspaceCooldown = 0; hyperspaceInvincible = 0;
|
|
698
|
+
shootCooldown = 0;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
function initMultiplayerPlayers() {
|
|
702
|
+
players = [];
|
|
703
|
+
for (let i = 0; i < playerCount; i++) {
|
|
704
|
+
players.push({ score: 0, lives: 3, level: 1, alive: true, initials: "" });
|
|
705
|
+
}
|
|
706
|
+
currentPlayer = 0;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
function formatScore(s) {
|
|
710
|
+
return String(s).padStart(5, "0");
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
function addScore(points) {
|
|
714
|
+
score += points;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
function getLevelSpeedMultiplier() {
|
|
718
|
+
return 1 + 0.15 * (level - 1);
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
function spawnAsteroids(count) {
|
|
722
|
+
for (let i = 0; i < count; i++) {
|
|
723
|
+
let x, y;
|
|
724
|
+
do {
|
|
725
|
+
x = Math.random() * canvas.width;
|
|
726
|
+
y = Math.random() * canvas.height;
|
|
727
|
+
} while (distance(x, y, ship.x, ship.y) < 150);
|
|
728
|
+
asteroids.push(createAsteroid(x, y, 3));
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
function createAsteroid(x, y, size) {
|
|
733
|
+
const speed = (0.5 * (4 - size) + 1.5 * Math.random()) * getLevelSpeedMultiplier();
|
|
734
|
+
const angle = Math.random() * Math.PI * 2;
|
|
735
|
+
const radii = [];
|
|
736
|
+
const points = 8 + Math.floor(5 * Math.random());
|
|
737
|
+
const baseRadius = 15 * size + 10;
|
|
738
|
+
for (let i = 0; i < points; i++)
|
|
739
|
+
radii.push(baseRadius * (0.7 + 0.6 * Math.random()));
|
|
740
|
+
return {
|
|
741
|
+
x, y,
|
|
742
|
+
vx: Math.cos(angle) * speed, vy: Math.sin(angle) * speed,
|
|
743
|
+
size, radii, points, rotation: 0,
|
|
744
|
+
rotationSpeed: 0.03 * (Math.random() - 0.5),
|
|
745
|
+
color: size === 3 ? "#ff00ff" : size === 2 ? "#ffff00" : "#00ffff"
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
function createSaucer() {
|
|
750
|
+
const isSmall = Math.random() > 0.5;
|
|
751
|
+
const fromLeft = Math.random() > 0.5;
|
|
752
|
+
const y = Math.random() * (canvas.height - 100) + 50;
|
|
753
|
+
return {
|
|
754
|
+
x: fromLeft ? -30 : canvas.width + 30, y,
|
|
755
|
+
vx: (fromLeft ? 1 : -1) * (isSmall ? 3 : 2) * getLevelSpeedMultiplier(),
|
|
756
|
+
vy: 0, isSmall,
|
|
757
|
+
radius: isSmall ? 15 : 25,
|
|
758
|
+
shootTimer: 60 + 60 * Math.random(),
|
|
759
|
+
directionChangeTimer: 60 + 120 * Math.random(),
|
|
760
|
+
points: isSmall ? 1000 : 500
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
function distance(x1, y1, x2, y2) {
|
|
765
|
+
return RetroGame.distance({x: x1, y: y1}, {x: x2, y: y2});
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
function wrap(obj) {
|
|
769
|
+
RetroGame.wrap(obj, canvas.width, canvas.height, 50);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
function createExplosion(x, y, color, count) {
|
|
773
|
+
particles.emit(x, y, count || 20, {
|
|
774
|
+
color: color, speed: 5, size: 3,
|
|
775
|
+
lifetime: 1.2, decay: 0.02, spread: Math.PI * 2
|
|
776
|
+
});
|
|
777
|
+
shake.trigger(10);
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
// --- Hyperspace ---
|
|
781
|
+
function hyperspace() {
|
|
782
|
+
if (hyperspaceCooldown > 0) return;
|
|
783
|
+
if (sfxReady) sfx.play('Hyperspace_Jump');
|
|
784
|
+
createExplosion(ship.x, ship.y, "#ffffff", 12);
|
|
785
|
+
ship.x = Math.random() * (canvas.width - 100) + 50;
|
|
786
|
+
ship.y = Math.random() * (canvas.height - 100) + 50;
|
|
787
|
+
ship.vx = 0; ship.vy = 0;
|
|
788
|
+
createExplosion(ship.x, ship.y, "#00ffff", 12);
|
|
789
|
+
hyperspaceCooldown = 180;
|
|
790
|
+
hyperspaceInvincible = 60;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
var shootCooldown = 0;
|
|
794
|
+
|
|
795
|
+
function shoot() {
|
|
796
|
+
if (shootCooldown > 0) return;
|
|
797
|
+
const cooldown = ship.rapidFire > 0 ? 5 : 15;
|
|
798
|
+
shootCooldown = cooldown;
|
|
799
|
+
if (sfxReady) sfx.play('Laser_Fire');
|
|
800
|
+
const offsets = ship.multiShot > 0 ? [-0.2, 0, 0.2] : [0];
|
|
801
|
+
offsets.forEach(function(offset) {
|
|
802
|
+
const angle = ship.angle + offset;
|
|
803
|
+
bullets.push({
|
|
804
|
+
x: ship.x + 20 * Math.cos(angle),
|
|
805
|
+
y: ship.y + 20 * Math.sin(angle),
|
|
806
|
+
vx: 10 * Math.cos(angle) + 0.5 * ship.vx,
|
|
807
|
+
vy: 10 * Math.sin(angle) + 0.5 * ship.vy,
|
|
808
|
+
life: 60
|
|
809
|
+
});
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
function saucerShoot(saucer) {
|
|
814
|
+
let angle = Math.atan2(ship.y - saucer.y, ship.x - saucer.x);
|
|
815
|
+
angle += (saucer.isSmall ? 0.2 : 0.5) * (Math.random() - 0.5);
|
|
816
|
+
saucerBullets.push({
|
|
817
|
+
x: saucer.x, y: saucer.y,
|
|
818
|
+
vx: 6 * Math.cos(angle), vy: 6 * Math.sin(angle),
|
|
819
|
+
life: 90
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
function spawnPowerUp(x, y) {
|
|
824
|
+
if (Math.random() > 0.15) return;
|
|
825
|
+
let type;
|
|
826
|
+
const rand = Math.random();
|
|
827
|
+
type = rand < 0.05 ? "life" : rand < 0.38 ? "shield" : rand < 0.71 ? "rapid" : "multi";
|
|
828
|
+
powerUps.push({ x, y, type, life: 600, pulse: 0 });
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
function updateUI() {
|
|
832
|
+
const scoreEl = document.getElementById("score");
|
|
833
|
+
if (score > MAX_SCORE) {
|
|
834
|
+
scoreEl.textContent = "99,999+";
|
|
835
|
+
scoreEl.className = "score-overflow";
|
|
836
|
+
scoreEl.title = score.toLocaleString();
|
|
837
|
+
} else {
|
|
838
|
+
scoreEl.textContent = formatScore(score);
|
|
839
|
+
scoreEl.className = "";
|
|
840
|
+
scoreEl.title = "";
|
|
841
|
+
}
|
|
842
|
+
document.getElementById("level").textContent = level;
|
|
843
|
+
document.getElementById("lives").textContent = lives;
|
|
844
|
+
|
|
845
|
+
// Player indicator for multiplayer
|
|
846
|
+
const piEl = document.getElementById("playerIndicator");
|
|
847
|
+
if (gameMode !== "single") {
|
|
848
|
+
piEl.style.display = "inline";
|
|
849
|
+
piEl.textContent = "P" + (currentPlayer + 1) + " ";
|
|
850
|
+
piEl.style.color = getActivePlayerColor();
|
|
851
|
+
} else {
|
|
852
|
+
piEl.style.display = "none";
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
function isShipInvincible() {
|
|
857
|
+
return ship.invincible > 0 || ship.shield > 0 || hyperspaceInvincible > 0;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
// Gamepad polling is now handled by gamepad.poll() in the game loop
|
|
861
|
+
// Game-specific action functions (gpFire, gpHyper, etc.) are defined above
|
|
862
|
+
|
|
863
|
+
// --- Multiplayer Turn Management ---
|
|
864
|
+
var TURN_COOLDOWN_MS = 3000; // 3 second cooldown between players
|
|
865
|
+
var turnReadyAt = 0;
|
|
866
|
+
|
|
867
|
+
function showTurnReady() {
|
|
868
|
+
turnReady = true;
|
|
869
|
+
turnReadyAt = Date.now();
|
|
870
|
+
const overlay = document.getElementById("turnReadyOverlay");
|
|
871
|
+
const nameEl = document.getElementById("turnPlayerName");
|
|
872
|
+
const color = getActivePlayerColor();
|
|
873
|
+
nameEl.textContent = "PLAYER " + (currentPlayer + 1);
|
|
874
|
+
nameEl.style.color = color;
|
|
875
|
+
updateAllPrompts();
|
|
876
|
+
overlay.classList.add("visible");
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
function getTurnCooldownRemaining() {
|
|
880
|
+
return Math.max(0, TURN_COOLDOWN_MS - (Date.now() - turnReadyAt));
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
function updateTurnPrompt() {
|
|
884
|
+
var remaining = getTurnCooldownRemaining();
|
|
885
|
+
var promptEl = document.getElementById("turnPrompt");
|
|
886
|
+
if (remaining > 0) {
|
|
887
|
+
var secs = Math.ceil(remaining / 1000);
|
|
888
|
+
promptEl.textContent = "Get ready... " + secs;
|
|
889
|
+
} else {
|
|
890
|
+
promptEl.innerHTML = btnText(
|
|
891
|
+
"Press SPACE to start",
|
|
892
|
+
"Press " + gpBtn("a") + " to start"
|
|
893
|
+
);
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
function hideTurnReady() {
|
|
898
|
+
turnReady = false;
|
|
899
|
+
document.getElementById("turnReadyOverlay").classList.remove("visible");
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
function startPlayerTurn() {
|
|
903
|
+
hideTurnReady();
|
|
904
|
+
if (gameMode === "solo_turns") {
|
|
905
|
+
// Fresh game for each player
|
|
906
|
+
initGame();
|
|
907
|
+
score = 0;
|
|
908
|
+
lives = 3;
|
|
909
|
+
level = 1;
|
|
910
|
+
} else if (gameMode === "hot_seat") {
|
|
911
|
+
// Load this player's state into shared field
|
|
912
|
+
const p = players[currentPlayer];
|
|
913
|
+
score = p.score;
|
|
914
|
+
lives = p.lives;
|
|
915
|
+
initHotSeatRespawn();
|
|
916
|
+
}
|
|
917
|
+
gameRunning = true;
|
|
918
|
+
startAmbient();
|
|
919
|
+
updateUI();
|
|
920
|
+
updateBottomBar();
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
function saveCurrentPlayerState() {
|
|
924
|
+
if (gameMode === "single") return;
|
|
925
|
+
players[currentPlayer].score = score;
|
|
926
|
+
players[currentPlayer].lives = lives;
|
|
927
|
+
if (gameMode === "solo_turns") {
|
|
928
|
+
players[currentPlayer].level = level;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
function advanceToNextPlayer() {
|
|
933
|
+
saveCurrentPlayerState();
|
|
934
|
+
|
|
935
|
+
// Find next alive player
|
|
936
|
+
let next = -1;
|
|
937
|
+
for (let i = 1; i <= playerCount; i++) {
|
|
938
|
+
const idx = (currentPlayer + i) % playerCount;
|
|
939
|
+
if (players[idx].alive) { next = idx; break; }
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
if (next === -1) {
|
|
943
|
+
// All players eliminated
|
|
944
|
+
showFinalScoreboard();
|
|
945
|
+
return;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
currentPlayer = next;
|
|
949
|
+
gameRunning = false;
|
|
950
|
+
showTurnReady();
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
function handlePlayerDeath() {
|
|
954
|
+
if (gameMode === "single") {
|
|
955
|
+
gameOver();
|
|
956
|
+
return;
|
|
957
|
+
}
|
|
958
|
+
sfx.stop('Ship_Thrust');
|
|
959
|
+
|
|
960
|
+
if (gameMode === "solo_turns") {
|
|
961
|
+
// Player lost all lives — they're done
|
|
962
|
+
lives--;
|
|
963
|
+
updateUI();
|
|
964
|
+
if (lives <= 0) {
|
|
965
|
+
saveCurrentPlayerState();
|
|
966
|
+
players[currentPlayer].alive = false;
|
|
967
|
+
gameRunning = false;
|
|
968
|
+
// Check HS for this player
|
|
969
|
+
if (qualifiesForHighScore(score)) {
|
|
970
|
+
hsEntryPlayerIndex = currentPlayer;
|
|
971
|
+
showHighScoreEntry();
|
|
972
|
+
} else {
|
|
973
|
+
advanceToNextPlayer();
|
|
974
|
+
}
|
|
975
|
+
} else {
|
|
976
|
+
// Respawn
|
|
977
|
+
ship.x = canvas.width / 2; ship.y = canvas.height / 2;
|
|
978
|
+
ship.vx = 0; ship.vy = 0; ship.invincible = 180;
|
|
979
|
+
}
|
|
980
|
+
} else if (gameMode === "hot_seat") {
|
|
981
|
+
// Lost one life — rotate to next player
|
|
982
|
+
lives--;
|
|
983
|
+
updateUI();
|
|
984
|
+
saveCurrentPlayerState();
|
|
985
|
+
if (lives <= 0) {
|
|
986
|
+
players[currentPlayer].alive = false;
|
|
987
|
+
// Check HS for this player
|
|
988
|
+
if (qualifiesForHighScore(score)) {
|
|
989
|
+
hsEntryPlayerIndex = currentPlayer;
|
|
990
|
+
gameRunning = false;
|
|
991
|
+
showHighScoreEntry();
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
gameRunning = false;
|
|
996
|
+
advanceToNextPlayer();
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
function showFinalScoreboard() {
|
|
1001
|
+
gameRunning = false;
|
|
1002
|
+
stopAmbient();
|
|
1003
|
+
sfx.stop('Ship_Thrust');
|
|
1004
|
+
// Sort players by score descending
|
|
1005
|
+
const ranked = players.map(function(p, i) { return { index: i, score: p.score, initials: p.initials }; });
|
|
1006
|
+
ranked.sort(function(a, b) { return b.score - a.score; });
|
|
1007
|
+
|
|
1008
|
+
const modeLabel = gameMode === "solo_turns" ? "SOLO TURNS" : "HOT SEAT";
|
|
1009
|
+
document.getElementById("sbSubtitle").textContent = modeLabel + " \u2014 FINAL STANDINGS";
|
|
1010
|
+
|
|
1011
|
+
const tbody = document.getElementById("sbBody");
|
|
1012
|
+
tbody.innerHTML = "";
|
|
1013
|
+
ranked.forEach(function(r, rank) {
|
|
1014
|
+
const tr = document.createElement("tr");
|
|
1015
|
+
const color = PLAYER_COLORS[r.index];
|
|
1016
|
+
const initStr = r.initials || "";
|
|
1017
|
+
tr.innerHTML =
|
|
1018
|
+
'<td class="sb-rank">' + (rank + 1) + '.</td>' +
|
|
1019
|
+
'<td class="sb-player" style="color:' + color + ';text-shadow:0 0 10px ' + color + '">P' + (r.index + 1) + '</td>' +
|
|
1020
|
+
'<td class="sb-initials">' + initStr + '</td>' +
|
|
1021
|
+
'<td class="sb-score">' + r.score.toLocaleString() + '</td>';
|
|
1022
|
+
tbody.appendChild(tr);
|
|
1023
|
+
});
|
|
1024
|
+
|
|
1025
|
+
document.getElementById("finalScoreboard").classList.add("visible");
|
|
1026
|
+
updateBottomBar();
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
function hideFinalScoreboard() {
|
|
1030
|
+
document.getElementById("finalScoreboard").classList.remove("visible");
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
// --- Start Screen UI Logic ---
|
|
1034
|
+
var menuCursor = 0; // index of focused item in current phase
|
|
1035
|
+
|
|
1036
|
+
// Items per phase: mode=[1P, PassPlay], submode=[Solo, HotSeat], count=N/A (uses arrows)
|
|
1037
|
+
function getMenuItems() {
|
|
1038
|
+
if (startScreenPhase === "mode") return [document.getElementById("btn1P"), document.getElementById("btnPassPlay")];
|
|
1039
|
+
if (startScreenPhase === "submode") return [document.getElementById("btnSoloTurns"), document.getElementById("btnHotSeat")];
|
|
1040
|
+
return [];
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
function updateMenuFocus() {
|
|
1044
|
+
// Clear all focused classes
|
|
1045
|
+
var all = document.querySelectorAll(".mode-btn.focused, .submode-btn.focused");
|
|
1046
|
+
for (var i = 0; i < all.length; i++) all[i].classList.remove("focused");
|
|
1047
|
+
// Apply to current
|
|
1048
|
+
var items = getMenuItems();
|
|
1049
|
+
if (items.length > 0 && menuCursor >= 0 && menuCursor < items.length) {
|
|
1050
|
+
items[menuCursor].classList.add("focused");
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
function showStartPhase(phase) {
|
|
1055
|
+
startScreenPhase = phase;
|
|
1056
|
+
menuCursor = 0;
|
|
1057
|
+
var modeSelect = document.getElementById("modeSelect");
|
|
1058
|
+
var submodeSelect = document.getElementById("submodeSelect");
|
|
1059
|
+
var pcSelect = document.getElementById("playerCountSelect");
|
|
1060
|
+
modeSelect.style.display = phase === "mode" ? "flex" : "none";
|
|
1061
|
+
submodeSelect.style.display = phase === "submode" ? "flex" : "none";
|
|
1062
|
+
pcSelect.style.display = "none";
|
|
1063
|
+
pcSelect.classList.remove("visible");
|
|
1064
|
+
if (phase === "count") {
|
|
1065
|
+
pcSelect.style.display = "flex";
|
|
1066
|
+
pcSelect.classList.add("visible");
|
|
1067
|
+
}
|
|
1068
|
+
updateMenuFocus();
|
|
1069
|
+
updateBottomBar();
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
function resetStartScreen() {
|
|
1073
|
+
var startScreen = document.getElementById("startScreen");
|
|
1074
|
+
startScreen.style.display = "";
|
|
1075
|
+
showStartPhase("mode");
|
|
1076
|
+
playerCount = 2;
|
|
1077
|
+
document.getElementById("pcNum").textContent = "2";
|
|
1078
|
+
document.getElementById("gameOverScreen").style.display = "none";
|
|
1079
|
+
hideFinalScoreboard();
|
|
1080
|
+
hideTurnReady();
|
|
1081
|
+
stopAmbient();
|
|
1082
|
+
sfx.stop('Ship_Thrust');
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
function menuConfirm() {
|
|
1086
|
+
if (startScreenPhase === "mode") {
|
|
1087
|
+
if (menuCursor === 0) startSinglePlayer();
|
|
1088
|
+
else if (menuCursor === 1) showStartPhase("submode");
|
|
1089
|
+
} else if (startScreenPhase === "submode") {
|
|
1090
|
+
if (menuCursor === 0) selectSubmode("solo_turns");
|
|
1091
|
+
else if (menuCursor === 1) selectSubmode("hot_seat");
|
|
1092
|
+
} else if (startScreenPhase === "count") {
|
|
1093
|
+
confirmPlayerCount();
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
function menuBack() {
|
|
1098
|
+
if (startScreenPhase === "submode") {
|
|
1099
|
+
showStartPhase("mode");
|
|
1100
|
+
menuCursor = 1; // return focus to "Pass & Play"
|
|
1101
|
+
updateMenuFocus();
|
|
1102
|
+
} else if (startScreenPhase === "count") {
|
|
1103
|
+
showStartPhase("submode");
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
function menuMove(delta) {
|
|
1108
|
+
var items = getMenuItems();
|
|
1109
|
+
if (items.length === 0) return;
|
|
1110
|
+
var prev = menuCursor;
|
|
1111
|
+
menuCursor = Math.max(0, Math.min(items.length - 1, menuCursor + delta));
|
|
1112
|
+
if (menuCursor !== prev && sfxReady) sfx.play('Menu_Navigate');
|
|
1113
|
+
updateMenuFocus();
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
function startSinglePlayer() {
|
|
1117
|
+
document.getElementById("startScreen").style.display = "none";
|
|
1118
|
+
gameMode = "single";
|
|
1119
|
+
initGame();
|
|
1120
|
+
gameRunning = true;
|
|
1121
|
+
startAmbient();
|
|
1122
|
+
updateBottomBar();
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
function selectSubmode(mode) {
|
|
1126
|
+
gameMode = mode;
|
|
1127
|
+
showStartPhase("count");
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
function adjustPlayerCount(delta) {
|
|
1131
|
+
playerCount = Math.max(2, Math.min(8, playerCount + delta));
|
|
1132
|
+
document.getElementById("pcNum").textContent = playerCount;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
function confirmPlayerCount() {
|
|
1136
|
+
document.getElementById("startScreen").style.display = "none";
|
|
1137
|
+
initMultiplayerPlayers();
|
|
1138
|
+
currentPlayer = 0;
|
|
1139
|
+
|
|
1140
|
+
if (gameMode === "hot_seat") {
|
|
1141
|
+
initGame();
|
|
1142
|
+
gameRunning = false;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
showTurnReady();
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
// Start screen button events
|
|
1149
|
+
document.getElementById("btn1P").addEventListener("click", startSinglePlayer);
|
|
1150
|
+
document.getElementById("btnPassPlay").addEventListener("click", function() { showStartPhase("submode"); });
|
|
1151
|
+
document.getElementById("btnSoloTurns").addEventListener("click", function() { selectSubmode("solo_turns"); });
|
|
1152
|
+
document.getElementById("btnHotSeat").addEventListener("click", function() { selectSubmode("hot_seat"); });
|
|
1153
|
+
// Mouse hover syncs focus cursor
|
|
1154
|
+
document.getElementById("btn1P").addEventListener("mouseenter", function() { if (menuCursor !== 0 && sfxReady) sfx.play('Menu_Navigate'); menuCursor = 0; updateMenuFocus(); });
|
|
1155
|
+
document.getElementById("btnPassPlay").addEventListener("mouseenter", function() { if (menuCursor !== 1 && sfxReady) sfx.play('Menu_Navigate'); menuCursor = 1; updateMenuFocus(); });
|
|
1156
|
+
document.getElementById("btnSoloTurns").addEventListener("mouseenter", function() { if (menuCursor !== 0 && sfxReady) sfx.play('Menu_Navigate'); menuCursor = 0; updateMenuFocus(); });
|
|
1157
|
+
document.getElementById("btnHotSeat").addEventListener("mouseenter", function() { if (menuCursor !== 1 && sfxReady) sfx.play('Menu_Navigate'); menuCursor = 1; updateMenuFocus(); });
|
|
1158
|
+
document.getElementById("pcLeft").addEventListener("click", function() { adjustPlayerCount(-1); });
|
|
1159
|
+
document.getElementById("pcRight").addEventListener("click", function() { adjustPlayerCount(1); });
|
|
1160
|
+
document.getElementById("pcConfirm").addEventListener("click", confirmPlayerCount);
|
|
1161
|
+
document.getElementById("sbPlayAgain").addEventListener("click", function() { resetStartScreen(); });
|
|
1162
|
+
|
|
1163
|
+
function update() {
|
|
1164
|
+
// keyboard.poll() and gamepad.poll() are called in gameLoop() before this
|
|
1165
|
+
|
|
1166
|
+
// Gamepad pause toggle (edge-triggered, works even when paused)
|
|
1167
|
+
if (gpPause() && gameRunning) {
|
|
1168
|
+
gamePaused = !gamePaused;
|
|
1169
|
+
if (gamePaused) pauseOverlay.classList.add("visible");
|
|
1170
|
+
else pauseOverlay.classList.remove("visible");
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
if (!gameRunning || gamePaused) return;
|
|
1174
|
+
|
|
1175
|
+
// Gamepad hyperspace (edge-triggered)
|
|
1176
|
+
if (gpHyper()) hyperspace();
|
|
1177
|
+
|
|
1178
|
+
// Ship controls (keyboard OR gamepad)
|
|
1179
|
+
if (keyboard.isDown("ArrowLeft") || keyboard.isDown("KeyA") || gamepad.left) ship.angle -= 0.08;
|
|
1180
|
+
if (keyboard.isDown("ArrowRight") || keyboard.isDown("KeyD") || gamepad.right) ship.angle += 0.08;
|
|
1181
|
+
if (keyboard.isDown("ArrowUp") || keyboard.isDown("KeyW") || gamepad.up) {
|
|
1182
|
+
ship.vx += 0.15 * Math.cos(ship.angle);
|
|
1183
|
+
ship.vy += 0.15 * Math.sin(ship.angle);
|
|
1184
|
+
ship.thrust = 1;
|
|
1185
|
+
if (sfxReady) sfx.play('Ship_Thrust');
|
|
1186
|
+
} else {
|
|
1187
|
+
if (ship.thrust > 0.1 && sfxReady) sfx.stop('Ship_Thrust');
|
|
1188
|
+
ship.thrust *= 0.95;
|
|
1189
|
+
}
|
|
1190
|
+
if (keyboard.isDown("Space") || gpFire()) shoot();
|
|
1191
|
+
|
|
1192
|
+
ship.vx *= 0.99;
|
|
1193
|
+
ship.vy *= 0.99;
|
|
1194
|
+
const speed = Math.sqrt(ship.vx ** 2 + ship.vy ** 2);
|
|
1195
|
+
if (speed > 8) {
|
|
1196
|
+
ship.vx = ship.vx / speed * 8;
|
|
1197
|
+
ship.vy = ship.vy / speed * 8;
|
|
1198
|
+
}
|
|
1199
|
+
ship.x += ship.vx;
|
|
1200
|
+
ship.y += ship.vy;
|
|
1201
|
+
wrap(ship);
|
|
1202
|
+
|
|
1203
|
+
if (ship.invincible > 0) ship.invincible--;
|
|
1204
|
+
if (ship.shield > 0) ship.shield--;
|
|
1205
|
+
if (ship.rapidFire > 0) ship.rapidFire--;
|
|
1206
|
+
if (ship.multiShot > 0) ship.multiShot--;
|
|
1207
|
+
if (shootCooldown > 0) shootCooldown--;
|
|
1208
|
+
if (hyperspaceCooldown > 0) hyperspaceCooldown--;
|
|
1209
|
+
if (hyperspaceInvincible > 0) hyperspaceInvincible--;
|
|
1210
|
+
|
|
1211
|
+
// Saucer spawning
|
|
1212
|
+
if (level >= 2) {
|
|
1213
|
+
saucerSpawnTimer++;
|
|
1214
|
+
const spawnInterval = Math.max(300, 600 - 30 * level);
|
|
1215
|
+
if (saucerSpawnTimer >= spawnInterval && saucers.length < 2) {
|
|
1216
|
+
saucers.push(createSaucer());
|
|
1217
|
+
if (sfxReady) sfx.play('Saucer_Alert');
|
|
1218
|
+
saucerSpawnTimer = 0;
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
// Update saucers
|
|
1223
|
+
saucers = saucers.filter(function(s) {
|
|
1224
|
+
s.x += s.vx; s.y += s.vy;
|
|
1225
|
+
s.directionChangeTimer--;
|
|
1226
|
+
if (s.directionChangeTimer <= 0) {
|
|
1227
|
+
s.vy = 2 * (Math.random() - 0.5);
|
|
1228
|
+
s.directionChangeTimer = 60 + 120 * Math.random();
|
|
1229
|
+
}
|
|
1230
|
+
if (s.y < 50) s.vy = Math.abs(s.vy);
|
|
1231
|
+
if (s.y > canvas.height - 50) s.vy = -Math.abs(s.vy);
|
|
1232
|
+
s.shootTimer--;
|
|
1233
|
+
if (s.shootTimer <= 0) {
|
|
1234
|
+
saucerShoot(s);
|
|
1235
|
+
s.shootTimer = s.isSmall ? 40 + 40 * Math.random() : 60 + 60 * Math.random();
|
|
1236
|
+
}
|
|
1237
|
+
return s.x > -50 && s.x < canvas.width + 50;
|
|
1238
|
+
});
|
|
1239
|
+
|
|
1240
|
+
// Update saucer bullets
|
|
1241
|
+
saucerBullets = saucerBullets.filter(function(b) {
|
|
1242
|
+
b.x += b.vx; b.y += b.vy; b.life--;
|
|
1243
|
+
return b.life > 0 && b.x > -10 && b.x < canvas.width + 10 && b.y > -10 && b.y < canvas.height + 10;
|
|
1244
|
+
});
|
|
1245
|
+
|
|
1246
|
+
// Update bullets
|
|
1247
|
+
bullets = bullets.filter(function(b) {
|
|
1248
|
+
b.x += b.vx; b.y += b.vy; b.life--;
|
|
1249
|
+
wrap(b);
|
|
1250
|
+
return b.life > 0;
|
|
1251
|
+
});
|
|
1252
|
+
|
|
1253
|
+
// Update asteroids
|
|
1254
|
+
asteroids.forEach(function(a) {
|
|
1255
|
+
a.x += a.vx; a.y += a.vy;
|
|
1256
|
+
a.rotation += a.rotationSpeed;
|
|
1257
|
+
wrap(a);
|
|
1258
|
+
});
|
|
1259
|
+
|
|
1260
|
+
// Update particles
|
|
1261
|
+
particles.update(1/60);
|
|
1262
|
+
|
|
1263
|
+
// Update power-ups
|
|
1264
|
+
powerUps = powerUps.filter(function(p) {
|
|
1265
|
+
p.life--; p.pulse += 0.1;
|
|
1266
|
+
return p.life > 0;
|
|
1267
|
+
});
|
|
1268
|
+
|
|
1269
|
+
// Update stars
|
|
1270
|
+
stars.forEach(function(s) {
|
|
1271
|
+
s.y += s.speed;
|
|
1272
|
+
if (s.y > canvas.height) { s.y = 0; s.x = Math.random() * canvas.width; }
|
|
1273
|
+
s.brightness = 0.3 + 0.3 * Math.sin(0.003 * Date.now() + s.x);
|
|
1274
|
+
});
|
|
1275
|
+
|
|
1276
|
+
// Bullet-asteroid collisions
|
|
1277
|
+
bullets.forEach(function(b, bi) {
|
|
1278
|
+
asteroids.forEach(function(a, ai) {
|
|
1279
|
+
const avgRadius = a.radii.reduce(function(sum, r) { return sum + r; }, 0) / a.radii.length;
|
|
1280
|
+
if (distance(b.x, b.y, a.x, a.y) < avgRadius) {
|
|
1281
|
+
bullets.splice(bi, 1);
|
|
1282
|
+
if (sfxReady) sfx.play('Asteroid_Explosion');
|
|
1283
|
+
createExplosion(a.x, a.y, a.color, 15);
|
|
1284
|
+
if (a.size > 1) {
|
|
1285
|
+
for (let i = 0; i < 2; i++) asteroids.push(createAsteroid(a.x, a.y, a.size - 1));
|
|
1286
|
+
}
|
|
1287
|
+
spawnPowerUp(a.x, a.y);
|
|
1288
|
+
asteroids.splice(ai, 1);
|
|
1289
|
+
addScore(100 * (4 - a.size));
|
|
1290
|
+
updateUI();
|
|
1291
|
+
}
|
|
1292
|
+
});
|
|
1293
|
+
});
|
|
1294
|
+
|
|
1295
|
+
// Bullet-saucer collisions
|
|
1296
|
+
bullets.forEach(function(b, bi) {
|
|
1297
|
+
saucers.forEach(function(s, si) {
|
|
1298
|
+
if (distance(b.x, b.y, s.x, s.y) < s.radius) {
|
|
1299
|
+
bullets.splice(bi, 1);
|
|
1300
|
+
createExplosion(s.x, s.y, "#ff6600", 25);
|
|
1301
|
+
addScore(s.points);
|
|
1302
|
+
saucers.splice(si, 1);
|
|
1303
|
+
updateUI();
|
|
1304
|
+
}
|
|
1305
|
+
});
|
|
1306
|
+
});
|
|
1307
|
+
|
|
1308
|
+
// Ship-asteroid collisions
|
|
1309
|
+
if (!isShipInvincible()) {
|
|
1310
|
+
asteroids.forEach(function(a, ai) {
|
|
1311
|
+
const avgRadius = a.radii.reduce(function(sum, r) { return sum + r; }, 0) / a.radii.length;
|
|
1312
|
+
if (distance(ship.x, ship.y, a.x, a.y) < avgRadius + ship.radius) {
|
|
1313
|
+
createExplosion(ship.x, ship.y, getActivePlayerColor(), 30);
|
|
1314
|
+
if (gameMode !== "single") {
|
|
1315
|
+
handlePlayerDeath();
|
|
1316
|
+
} else {
|
|
1317
|
+
lives--;
|
|
1318
|
+
updateUI();
|
|
1319
|
+
if (lives <= 0) { gameOver(); return; }
|
|
1320
|
+
ship.x = canvas.width / 2; ship.y = canvas.height / 2;
|
|
1321
|
+
ship.vx = 0; ship.vy = 0; ship.invincible = 180;
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
// Ship-saucer collisions
|
|
1328
|
+
if (!isShipInvincible()) {
|
|
1329
|
+
saucers.forEach(function(s, si) {
|
|
1330
|
+
if (distance(ship.x, ship.y, s.x, s.y) < s.radius + ship.radius) {
|
|
1331
|
+
createExplosion(ship.x, ship.y, getActivePlayerColor(), 30);
|
|
1332
|
+
createExplosion(s.x, s.y, "#ff6600", 25);
|
|
1333
|
+
saucers.splice(si, 1);
|
|
1334
|
+
if (gameMode !== "single") {
|
|
1335
|
+
handlePlayerDeath();
|
|
1336
|
+
} else {
|
|
1337
|
+
lives--;
|
|
1338
|
+
updateUI();
|
|
1339
|
+
if (lives <= 0) { gameOver(); return; }
|
|
1340
|
+
ship.x = canvas.width / 2; ship.y = canvas.height / 2;
|
|
1341
|
+
ship.vx = 0; ship.vy = 0; ship.invincible = 180;
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
// Ship-saucerBullet collisions
|
|
1348
|
+
if (!isShipInvincible()) {
|
|
1349
|
+
saucerBullets.forEach(function(b, bi) {
|
|
1350
|
+
if (distance(ship.x, ship.y, b.x, b.y) < ship.radius + 5) {
|
|
1351
|
+
createExplosion(ship.x, ship.y, getActivePlayerColor(), 30);
|
|
1352
|
+
saucerBullets.splice(bi, 1);
|
|
1353
|
+
if (gameMode !== "single") {
|
|
1354
|
+
handlePlayerDeath();
|
|
1355
|
+
} else {
|
|
1356
|
+
lives--;
|
|
1357
|
+
updateUI();
|
|
1358
|
+
if (lives <= 0) { gameOver(); return; }
|
|
1359
|
+
ship.x = canvas.width / 2; ship.y = canvas.height / 2;
|
|
1360
|
+
ship.vx = 0; ship.vy = 0; ship.invincible = 180;
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
// Power-up pickups
|
|
1367
|
+
powerUps.forEach(function(p, pi) {
|
|
1368
|
+
if (distance(ship.x, ship.y, p.x, p.y) < 30) {
|
|
1369
|
+
powerUps.splice(pi, 1);
|
|
1370
|
+
if (sfxReady) sfx.play('Power_Up_Collect');
|
|
1371
|
+
createExplosion(p.x, p.y, "#00ff00", 10);
|
|
1372
|
+
switch (p.type) {
|
|
1373
|
+
case "shield": ship.shield = 600; break;
|
|
1374
|
+
case "rapid": ship.rapidFire = 600; break;
|
|
1375
|
+
case "multi": ship.multiShot = 600; break;
|
|
1376
|
+
case "life": lives = Math.min(lives + 1, 5); updateUI(); break;
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
});
|
|
1380
|
+
|
|
1381
|
+
// Next level
|
|
1382
|
+
if (asteroids.length === 0) {
|
|
1383
|
+
level++;
|
|
1384
|
+
updateUI();
|
|
1385
|
+
spawnAsteroids(3 + level);
|
|
1386
|
+
saucerSpawnTimer = 0;
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
shake.update(1/60);
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
function draw() {
|
|
1393
|
+
ctx.save();
|
|
1394
|
+
if (shake.isActive) ctx.translate(shake.offsetX, shake.offsetY);
|
|
1395
|
+
ctx.fillStyle = "#000";
|
|
1396
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
1397
|
+
|
|
1398
|
+
// Stars
|
|
1399
|
+
stars.forEach(function(s) {
|
|
1400
|
+
ctx.fillStyle = "rgba(255, 255, 255, " + s.brightness + ")";
|
|
1401
|
+
ctx.beginPath();
|
|
1402
|
+
ctx.arc(s.x, s.y, s.size, 0, 2 * Math.PI);
|
|
1403
|
+
ctx.fill();
|
|
1404
|
+
});
|
|
1405
|
+
|
|
1406
|
+
// Particles
|
|
1407
|
+
particles.draw(ctx);
|
|
1408
|
+
|
|
1409
|
+
// Power-ups
|
|
1410
|
+
powerUps.forEach(function(p) {
|
|
1411
|
+
const pulse = 5 * Math.sin(p.pulse);
|
|
1412
|
+
ctx.strokeStyle = p.type === "shield" ? "#00ffff" : p.type === "rapid" ? "#ff0000" : p.type === "multi" ? "#ffff00" : "#00ff00";
|
|
1413
|
+
ctx.lineWidth = 2;
|
|
1414
|
+
ctx.shadowColor = ctx.strokeStyle;
|
|
1415
|
+
ctx.shadowBlur = 15;
|
|
1416
|
+
ctx.beginPath();
|
|
1417
|
+
ctx.arc(p.x, p.y, 15 + pulse, 0, 2 * Math.PI);
|
|
1418
|
+
ctx.stroke();
|
|
1419
|
+
ctx.fillStyle = ctx.strokeStyle;
|
|
1420
|
+
ctx.font = "12px Arial";
|
|
1421
|
+
ctx.textAlign = "center";
|
|
1422
|
+
ctx.textBaseline = "middle";
|
|
1423
|
+
const icon = p.type === "shield" ? "S" : p.type === "rapid" ? "R" : p.type === "multi" ? "M" : "+";
|
|
1424
|
+
ctx.fillText(icon, p.x, p.y);
|
|
1425
|
+
ctx.shadowBlur = 0;
|
|
1426
|
+
});
|
|
1427
|
+
|
|
1428
|
+
// Asteroids
|
|
1429
|
+
asteroids.forEach(function(a) {
|
|
1430
|
+
ctx.save();
|
|
1431
|
+
ctx.translate(a.x, a.y);
|
|
1432
|
+
ctx.rotate(a.rotation);
|
|
1433
|
+
ctx.strokeStyle = a.color;
|
|
1434
|
+
ctx.lineWidth = 2;
|
|
1435
|
+
ctx.shadowColor = a.color;
|
|
1436
|
+
ctx.shadowBlur = 20;
|
|
1437
|
+
ctx.beginPath();
|
|
1438
|
+
for (let i = 0; i < a.points; i++) {
|
|
1439
|
+
const angle = i / a.points * Math.PI * 2;
|
|
1440
|
+
const r = a.radii[i];
|
|
1441
|
+
const x = Math.cos(angle) * r;
|
|
1442
|
+
const y = Math.sin(angle) * r;
|
|
1443
|
+
if (i === 0) ctx.moveTo(x, y); else ctx.lineTo(x, y);
|
|
1444
|
+
}
|
|
1445
|
+
ctx.closePath();
|
|
1446
|
+
ctx.stroke();
|
|
1447
|
+
ctx.restore();
|
|
1448
|
+
});
|
|
1449
|
+
|
|
1450
|
+
// Saucers
|
|
1451
|
+
saucers.forEach(function(s) {
|
|
1452
|
+
ctx.save();
|
|
1453
|
+
ctx.translate(s.x, s.y);
|
|
1454
|
+
ctx.strokeStyle = "#ff6600";
|
|
1455
|
+
ctx.lineWidth = 2;
|
|
1456
|
+
ctx.shadowColor = "#ff6600";
|
|
1457
|
+
ctx.shadowBlur = 20;
|
|
1458
|
+
const r = s.radius;
|
|
1459
|
+
ctx.beginPath(); ctx.ellipse(0, -0.2 * r, 0.4 * r, 0.3 * r, 0, Math.PI, 0); ctx.stroke();
|
|
1460
|
+
ctx.beginPath(); ctx.ellipse(0, 0, r, 0.35 * r, 0, 0, 2 * Math.PI); ctx.stroke();
|
|
1461
|
+
ctx.beginPath(); ctx.ellipse(0, 0.15 * r, 0.5 * r, 0.2 * r, 0, 0, Math.PI); ctx.stroke();
|
|
1462
|
+
ctx.fillStyle = "#ff6600";
|
|
1463
|
+
for (let i = 0; i < 3; i++) {
|
|
1464
|
+
const lx = (i - 1) * r * 0.5;
|
|
1465
|
+
ctx.beginPath(); ctx.arc(lx, 0, 3, 0, 2 * Math.PI); ctx.fill();
|
|
1466
|
+
}
|
|
1467
|
+
ctx.restore();
|
|
1468
|
+
});
|
|
1469
|
+
|
|
1470
|
+
// Saucer bullets
|
|
1471
|
+
saucerBullets.forEach(function(b) {
|
|
1472
|
+
ctx.fillStyle = "#ff6600";
|
|
1473
|
+
ctx.shadowColor = "#ff6600";
|
|
1474
|
+
ctx.shadowBlur = 15;
|
|
1475
|
+
ctx.beginPath();
|
|
1476
|
+
ctx.arc(b.x, b.y, 4, 0, 2 * Math.PI);
|
|
1477
|
+
ctx.fill();
|
|
1478
|
+
});
|
|
1479
|
+
|
|
1480
|
+
// Player bullets — use active player color
|
|
1481
|
+
const bulletColor = getActivePlayerColor();
|
|
1482
|
+
bullets.forEach(function(b) {
|
|
1483
|
+
ctx.fillStyle = bulletColor;
|
|
1484
|
+
ctx.shadowColor = bulletColor;
|
|
1485
|
+
ctx.shadowBlur = 15;
|
|
1486
|
+
ctx.beginPath();
|
|
1487
|
+
ctx.arc(b.x, b.y, 3, 0, 2 * Math.PI);
|
|
1488
|
+
ctx.fill();
|
|
1489
|
+
ctx.strokeStyle = bulletColor.replace(")", ", 0.5)").replace("rgb", "rgba").replace("#", "");
|
|
1490
|
+
// Use hex alpha approach for trail
|
|
1491
|
+
ctx.globalAlpha = 0.5;
|
|
1492
|
+
ctx.strokeStyle = bulletColor;
|
|
1493
|
+
ctx.lineWidth = 2;
|
|
1494
|
+
ctx.beginPath();
|
|
1495
|
+
ctx.moveTo(b.x, b.y);
|
|
1496
|
+
ctx.lineTo(b.x - 2 * b.vx, b.y - 2 * b.vy);
|
|
1497
|
+
ctx.stroke();
|
|
1498
|
+
ctx.globalAlpha = 1;
|
|
1499
|
+
});
|
|
1500
|
+
|
|
1501
|
+
// Ship — use active player color
|
|
1502
|
+
const shipColor = getActivePlayerColor();
|
|
1503
|
+
if (gameRunning && (ship.invincible <= 0 || Math.floor(ship.invincible / 5) % 2 === 0)) {
|
|
1504
|
+
ctx.save();
|
|
1505
|
+
ctx.translate(ship.x, ship.y);
|
|
1506
|
+
ctx.rotate(ship.angle);
|
|
1507
|
+
if (ship.shield > 0) {
|
|
1508
|
+
ctx.strokeStyle = shipColor.replace("ff", "80"); // semi-transparent
|
|
1509
|
+
ctx.globalAlpha = 0.5;
|
|
1510
|
+
ctx.strokeStyle = shipColor;
|
|
1511
|
+
ctx.lineWidth = 2;
|
|
1512
|
+
ctx.shadowColor = shipColor;
|
|
1513
|
+
ctx.shadowBlur = 20;
|
|
1514
|
+
ctx.beginPath();
|
|
1515
|
+
ctx.arc(0, 0, 25, 0, 2 * Math.PI);
|
|
1516
|
+
ctx.stroke();
|
|
1517
|
+
ctx.globalAlpha = 1;
|
|
1518
|
+
}
|
|
1519
|
+
if (hyperspaceInvincible > 0) {
|
|
1520
|
+
ctx.strokeStyle = "rgba(255, 255, 255, " + (0.3 + 0.2 * Math.sin(hyperspaceInvincible * 0.3)) + ")";
|
|
1521
|
+
ctx.lineWidth = 1;
|
|
1522
|
+
ctx.shadowColor = "#ffffff";
|
|
1523
|
+
ctx.shadowBlur = 25;
|
|
1524
|
+
ctx.beginPath();
|
|
1525
|
+
ctx.arc(0, 0, 22, 0, 2 * Math.PI);
|
|
1526
|
+
ctx.stroke();
|
|
1527
|
+
}
|
|
1528
|
+
ctx.strokeStyle = shipColor;
|
|
1529
|
+
ctx.lineWidth = 2;
|
|
1530
|
+
ctx.shadowColor = shipColor;
|
|
1531
|
+
ctx.shadowBlur = 15;
|
|
1532
|
+
ctx.beginPath();
|
|
1533
|
+
ctx.moveTo(20, 0);
|
|
1534
|
+
ctx.lineTo(-15, -12);
|
|
1535
|
+
ctx.lineTo(-8, 0);
|
|
1536
|
+
ctx.lineTo(-15, 12);
|
|
1537
|
+
ctx.closePath();
|
|
1538
|
+
ctx.stroke();
|
|
1539
|
+
if (ship.thrust > 0.1) {
|
|
1540
|
+
ctx.strokeStyle = "#ff6600";
|
|
1541
|
+
ctx.shadowColor = "#ff6600";
|
|
1542
|
+
ctx.beginPath();
|
|
1543
|
+
ctx.moveTo(-8, -5);
|
|
1544
|
+
ctx.lineTo(-20 - 10 * Math.random() * ship.thrust, 0);
|
|
1545
|
+
ctx.lineTo(-8, 5);
|
|
1546
|
+
ctx.stroke();
|
|
1547
|
+
}
|
|
1548
|
+
ctx.restore();
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
ctx.shadowBlur = 0;
|
|
1552
|
+
ctx.restore();
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
// --- Game Over & High Score Entry ---
|
|
1556
|
+
function gameOver() {
|
|
1557
|
+
gameRunning = false;
|
|
1558
|
+
stopAmbient();
|
|
1559
|
+
sfx.stop('Ship_Thrust');
|
|
1560
|
+
if (qualifiesForHighScore(score)) {
|
|
1561
|
+
hsEntryPlayerIndex = -1;
|
|
1562
|
+
showHighScoreEntry();
|
|
1563
|
+
} else {
|
|
1564
|
+
showGameOverScreen();
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
function showGameOverScreen() {
|
|
1569
|
+
document.getElementById("finalScore").textContent = score.toLocaleString();
|
|
1570
|
+
document.getElementById("gameOverScreen").style.display = "block";
|
|
1571
|
+
updateAllPrompts();
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
function showHighScoreEntry() {
|
|
1575
|
+
hsFinalScore = score;
|
|
1576
|
+
hsSlots = [0, 0, 0];
|
|
1577
|
+
hsActiveSlot = 0;
|
|
1578
|
+
hsEntryActive = true;
|
|
1579
|
+
document.getElementById("hsScore").textContent = score.toLocaleString();
|
|
1580
|
+
updateSlotDisplay();
|
|
1581
|
+
document.getElementById("highScoreEntry").style.display = "block";
|
|
1582
|
+
updateAllPrompts();
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
function updateSlotDisplay() {
|
|
1586
|
+
for (let i = 0; i < 3; i++) {
|
|
1587
|
+
const el = document.getElementById("slot" + i);
|
|
1588
|
+
el.textContent = String.fromCharCode(65 + hsSlots[i]);
|
|
1589
|
+
el.className = "initial-slot" + (i === hsActiveSlot ? " active" : "");
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
function confirmHighScore() {
|
|
1594
|
+
const initials = String.fromCharCode(65 + hsSlots[0]) +
|
|
1595
|
+
String.fromCharCode(65 + hsSlots[1]) +
|
|
1596
|
+
String.fromCharCode(65 + hsSlots[2]);
|
|
1597
|
+
insertHighScore(initials, hsFinalScore);
|
|
1598
|
+
hsEntryActive = false;
|
|
1599
|
+
document.getElementById("highScoreEntry").style.display = "none";
|
|
1600
|
+
|
|
1601
|
+
// In multiplayer, store initials and advance
|
|
1602
|
+
if (hsEntryPlayerIndex >= 0 && gameMode !== "single") {
|
|
1603
|
+
players[hsEntryPlayerIndex].initials = initials;
|
|
1604
|
+
advanceToNextPlayer();
|
|
1605
|
+
} else {
|
|
1606
|
+
showGameOverScreen();
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
var _turnStartPressed = false;
|
|
1611
|
+
|
|
1612
|
+
function gameLoop() {
|
|
1613
|
+
keyboard.poll();
|
|
1614
|
+
gamepad.poll();
|
|
1615
|
+
|
|
1616
|
+
// --- Turn ready overlay: cooldown then wait for player input ---
|
|
1617
|
+
if (turnReady) {
|
|
1618
|
+
updateTurnPrompt();
|
|
1619
|
+
if (getTurnCooldownRemaining() <= 0) {
|
|
1620
|
+
if (gpConfirm() || _turnStartPressed) {
|
|
1621
|
+
_turnStartPressed = false;
|
|
1622
|
+
startPlayerTurn();
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
// Still draw background
|
|
1626
|
+
draw();
|
|
1627
|
+
saveDirState();
|
|
1628
|
+
requestAnimationFrame(gameLoop);
|
|
1629
|
+
return;
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
// Gamepad menu/HS entry controls (when game not running)
|
|
1633
|
+
if (hsEntryActive) {
|
|
1634
|
+
if (gpUp()) { hsSlots[hsActiveSlot] = (hsSlots[hsActiveSlot] + 1) % 26; updateSlotDisplay(); }
|
|
1635
|
+
if (gpDown()) { hsSlots[hsActiveSlot] = (hsSlots[hsActiveSlot] + 25) % 26; updateSlotDisplay(); }
|
|
1636
|
+
if (gpLeft()) { hsActiveSlot = Math.max(0, hsActiveSlot - 1); updateSlotDisplay(); }
|
|
1637
|
+
if (gpRight()) { hsActiveSlot = Math.min(2, hsActiveSlot + 1); updateSlotDisplay(); }
|
|
1638
|
+
// A = accept letter & advance, confirm on last slot
|
|
1639
|
+
if (gpConfirm()) {
|
|
1640
|
+
if (hsActiveSlot < 2) { hsActiveSlot++; updateSlotDisplay(); }
|
|
1641
|
+
else confirmHighScore();
|
|
1642
|
+
}
|
|
1643
|
+
// B = go back one slot
|
|
1644
|
+
if (gpBack()) {
|
|
1645
|
+
if (hsActiveSlot > 0) { hsActiveSlot--; updateSlotDisplay(); }
|
|
1646
|
+
}
|
|
1647
|
+
} else if (!gameRunning) {
|
|
1648
|
+
// Start screen navigation with gamepad (d-pad + A/B)
|
|
1649
|
+
if (document.getElementById("startScreen").style.display !== "none") {
|
|
1650
|
+
if (startScreenPhase === "mode" || startScreenPhase === "submode") {
|
|
1651
|
+
if (gpUp()) menuMove(-1);
|
|
1652
|
+
if (gpDown()) menuMove(1);
|
|
1653
|
+
if (gpConfirm()) menuConfirm();
|
|
1654
|
+
if (gpBack()) menuBack(); // B = back
|
|
1655
|
+
} else if (startScreenPhase === "count") {
|
|
1656
|
+
if (gpLeft()) adjustPlayerCount(-1);
|
|
1657
|
+
if (gpRight()) adjustPlayerCount(1);
|
|
1658
|
+
if (gpConfirm()) confirmPlayerCount();
|
|
1659
|
+
if (gpBack()) menuBack(); // B = back
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
// Game over screen — restart
|
|
1663
|
+
const gameOverScreen = document.getElementById("gameOverScreen");
|
|
1664
|
+
if (gameOverScreen.style.display === "block") {
|
|
1665
|
+
if (gpConfirm() || gpPause()) {
|
|
1666
|
+
gameOverScreen.style.display = "none";
|
|
1667
|
+
resetStartScreen();
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
// Final scoreboard — play again
|
|
1671
|
+
if (document.getElementById("finalScoreboard").classList.contains("visible")) {
|
|
1672
|
+
if (gpConfirm() || gpPause()) {
|
|
1673
|
+
resetStartScreen();
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
update();
|
|
1679
|
+
draw();
|
|
1680
|
+
saveDirState();
|
|
1681
|
+
requestAnimationFrame(gameLoop);
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
// --- Input Handling (one-shot keyboard actions) ---
|
|
1685
|
+
// Continuous key state is handled by keyboard.isDown() via RetroGame.createKeyboard()
|
|
1686
|
+
document.addEventListener("keydown", function(e) {
|
|
1687
|
+
// Turn ready: SPACE to start
|
|
1688
|
+
if (turnReady) {
|
|
1689
|
+
if (e.code === "Space") {
|
|
1690
|
+
_turnStartPressed = true;
|
|
1691
|
+
e.preventDefault();
|
|
1692
|
+
}
|
|
1693
|
+
return;
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
if (hsEntryActive) {
|
|
1697
|
+
if (e.code === "ArrowLeft") {
|
|
1698
|
+
hsActiveSlot = Math.max(0, hsActiveSlot - 1);
|
|
1699
|
+
updateSlotDisplay();
|
|
1700
|
+
} else if (e.code === "ArrowRight") {
|
|
1701
|
+
hsActiveSlot = Math.min(2, hsActiveSlot + 1);
|
|
1702
|
+
updateSlotDisplay();
|
|
1703
|
+
} else if (e.code === "ArrowUp") {
|
|
1704
|
+
hsSlots[hsActiveSlot] = (hsSlots[hsActiveSlot] + 1) % 26;
|
|
1705
|
+
updateSlotDisplay();
|
|
1706
|
+
} else if (e.code === "ArrowDown") {
|
|
1707
|
+
hsSlots[hsActiveSlot] = (hsSlots[hsActiveSlot] + 25) % 26;
|
|
1708
|
+
updateSlotDisplay();
|
|
1709
|
+
} else if (e.code === "Enter") {
|
|
1710
|
+
confirmHighScore();
|
|
1711
|
+
}
|
|
1712
|
+
e.preventDefault();
|
|
1713
|
+
return;
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
// Start screen keyboard navigation
|
|
1717
|
+
if (!gameRunning && document.getElementById("startScreen").style.display !== "none") {
|
|
1718
|
+
if (startScreenPhase === "mode" || startScreenPhase === "submode") {
|
|
1719
|
+
if (e.code === "ArrowUp") { menuMove(-1); e.preventDefault(); }
|
|
1720
|
+
if (e.code === "ArrowDown") { menuMove(1); e.preventDefault(); }
|
|
1721
|
+
if (e.code === "Space" || e.code === "Enter") { menuConfirm(); e.preventDefault(); }
|
|
1722
|
+
if (e.code === "Escape" || e.code === "Backspace") { menuBack(); e.preventDefault(); }
|
|
1723
|
+
} else if (startScreenPhase === "count") {
|
|
1724
|
+
if (e.code === "ArrowLeft") { adjustPlayerCount(-1); e.preventDefault(); }
|
|
1725
|
+
if (e.code === "ArrowRight") { adjustPlayerCount(1); e.preventDefault(); }
|
|
1726
|
+
if (e.code === "Space" || e.code === "Enter") { confirmPlayerCount(); e.preventDefault(); }
|
|
1727
|
+
if (e.code === "Escape" || e.code === "Backspace") { menuBack(); e.preventDefault(); }
|
|
1728
|
+
}
|
|
1729
|
+
return;
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
if (e.code === "KeyP" && gameRunning) {
|
|
1733
|
+
gamePaused = !gamePaused;
|
|
1734
|
+
if (gamePaused) {
|
|
1735
|
+
pauseOverlay.classList.add("visible");
|
|
1736
|
+
} else {
|
|
1737
|
+
pauseOverlay.classList.remove("visible");
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
if (e.code === "KeyH" && gameRunning && !gamePaused) {
|
|
1742
|
+
hyperspace();
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
// Game over: space or enter to go back to start
|
|
1746
|
+
const gameOverScreen = document.getElementById("gameOverScreen");
|
|
1747
|
+
if (!gameRunning && gameOverScreen.style.display === "block" && (e.code === "Space" || e.code === "Enter")) {
|
|
1748
|
+
gameOverScreen.style.display = "none";
|
|
1749
|
+
resetStartScreen();
|
|
1750
|
+
e.preventDefault();
|
|
1751
|
+
return;
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
// Final scoreboard: space or enter to go back to start
|
|
1755
|
+
if (!gameRunning && document.getElementById("finalScoreboard").classList.contains("visible") && (e.code === "Space" || e.code === "Enter")) {
|
|
1756
|
+
resetStartScreen();
|
|
1757
|
+
e.preventDefault();
|
|
1758
|
+
return;
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
if (["Space", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(e.code)) {
|
|
1762
|
+
e.preventDefault();
|
|
1763
|
+
}
|
|
1764
|
+
});
|
|
1765
|
+
|
|
1766
|
+
document.getElementById("restartBtn").addEventListener("click", function() {
|
|
1767
|
+
document.getElementById("gameOverScreen").style.display = "none";
|
|
1768
|
+
resetStartScreen();
|
|
1769
|
+
});
|
|
1770
|
+
|
|
1771
|
+
// Initialize
|
|
1772
|
+
updateAllPrompts();
|
|
1773
|
+
initStars();
|
|
1774
|
+
gameLoop();
|
|
1775
|
+
</script>
|
|
1776
|
+
|
|
1777
|
+
</body></html>
|