@auraindustry/aurajs 0.0.6 → 0.1.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.
Files changed (334) hide show
  1. package/README.md +103 -7
  2. package/benchmarks/perf-thresholds.json +54 -0
  3. package/package.json +4 -7
  4. package/src/asset-pack.mjs +5 -1
  5. package/src/authored-project.mjs +1449 -0
  6. package/src/authored-runtime.mjs +2016 -0
  7. package/src/authoring/avatar-animation-graph.mjs +648 -0
  8. package/src/bin-integrity.mjs +272 -0
  9. package/src/build-contract/assets.mjs +130 -0
  10. package/src/build-contract/capabilities.mjs +116 -0
  11. package/src/build-contract/constants.mjs +6 -0
  12. package/src/build-contract/helpers.mjs +44 -0
  13. package/src/build-contract/web-templates.mjs +5993 -0
  14. package/src/build-contract.mjs +27 -2910
  15. package/src/bundler.mjs +188 -55
  16. package/src/cli.mjs +4825 -1512
  17. package/src/commands/project-authoring.mjs +434 -0
  18. package/src/config.mjs +27 -0
  19. package/src/conformance/cases/app-and-ui-runtime-cases.mjs +3309 -0
  20. package/src/conformance/cases/core-runtime-cases.mjs +1431 -0
  21. package/src/conformance/cases/index.mjs +11 -0
  22. package/src/conformance/cases/scene3d-and-media-cases.mjs +2094 -0
  23. package/src/conformance/cases/systems-and-gameplay-cases.mjs +1776 -0
  24. package/src/conformance/shared.mjs +27 -0
  25. package/src/conformance-runner.mjs +25 -13
  26. package/src/conformance.mjs +619 -4020
  27. package/src/cutscene.mjs +362 -5
  28. package/src/dev-cli-action.mjs +249 -0
  29. package/src/dev-cli-inspect.mjs +92 -0
  30. package/src/dev-cli-state.mjs +80 -0
  31. package/src/external-asset-cache.mjs +587 -0
  32. package/src/external-asset-policy.mjs +217 -0
  33. package/src/external-package-surface.mjs +206 -0
  34. package/src/game-action-runtime.mjs +869 -0
  35. package/src/game-state-runtime.mjs +206 -6
  36. package/src/headless-action.mjs +186 -0
  37. package/src/headless-test/runtime-animation.mjs +1173 -0
  38. package/src/headless-test/runtime-coordinator.mjs +1514 -0
  39. package/src/headless-test/runtime-primitives.mjs +320 -0
  40. package/src/headless-test/runtime-world.mjs +2253 -0
  41. package/src/headless-test.mjs +392 -4298
  42. package/src/host-binary.mjs +342 -14
  43. package/src/icon-discovery.mjs +64 -0
  44. package/src/make-catalog.mjs +109 -0
  45. package/src/make.mjs +197 -0
  46. package/src/package-integrity.mjs +586 -0
  47. package/src/perf-benchmark.mjs +353 -0
  48. package/src/postinstall.mjs +5 -5
  49. package/src/prefabs/index.mjs +34 -0
  50. package/src/prefabs/scene-serialization.mjs +184 -0
  51. package/src/project-importer.mjs +620 -0
  52. package/src/project-registry.mjs +24 -0
  53. package/src/publish-command.mjs +195 -0
  54. package/src/publish-env-example.mjs +83 -0
  55. package/src/publish-validation.mjs +708 -0
  56. package/src/retro/assets/compile.mjs +232 -0
  57. package/src/retro/backend-gba/authoring.mjs +1029 -0
  58. package/src/retro/backend-gba/rom.mjs +363 -0
  59. package/src/retro/backend-gbc/rom.mjs +85 -0
  60. package/src/retro/build.mjs +278 -0
  61. package/src/retro/cli/commands.mjs +292 -0
  62. package/src/retro/cli/templates.mjs +84 -0
  63. package/src/retro/diagnostics/catalog.mjs +110 -0
  64. package/src/retro/diagnostics/emit.mjs +72 -0
  65. package/src/retro/emulator/case-overlay.mjs +64 -0
  66. package/src/retro/emulator/discovery.mjs +158 -0
  67. package/src/retro/emulator/macos-case-overlay.swift +220 -0
  68. package/src/retro/emulator/profiles.mjs +146 -0
  69. package/src/retro/emulator/runner.mjs +289 -0
  70. package/src/retro/frontend/load-project.mjs +98 -0
  71. package/src/retro/index.mjs +30 -0
  72. package/src/retro/ir/build-ir.mjs +108 -0
  73. package/src/retro/runtime-gba/contract.mjs +151 -0
  74. package/src/retro/runtime-gbc/contract.mjs +117 -0
  75. package/src/retro/shared/span.mjs +26 -0
  76. package/src/retro/shared/targets.mjs +64 -0
  77. package/src/retro/validator/check-project.mjs +114 -0
  78. package/src/runtime-hotspot-audit.mjs +707 -0
  79. package/src/scaffold/config.mjs +1000 -0
  80. package/src/scaffold/fs.mjs +56 -0
  81. package/src/scaffold/layout.mjs +318 -0
  82. package/src/scaffold/project-docs.mjs +438 -0
  83. package/src/scaffold.mjs +93 -596
  84. package/src/scene-composition/index.mjs +326 -0
  85. package/src/scene-composition/runtime.mjs +751 -0
  86. package/src/self-hosted-assets.mjs +604 -0
  87. package/src/session-client.mjs +750 -0
  88. package/src/session-native-launcher.mjs +74 -0
  89. package/src/session-protocol.mjs +75 -0
  90. package/src/session-runtime.mjs +321 -0
  91. package/src/session-server.mjs +360 -0
  92. package/src/shader-kits/index.mjs +773 -0
  93. package/src/starter-content-registry.mjs +292 -0
  94. package/src/state-artifacts.mjs +662 -24
  95. package/src/state-dev-reload.mjs +99 -2
  96. package/src/terminal-ui.mjs +245 -0
  97. package/src/web-conformance.mjs +219 -0
  98. package/templates/create/2d/config/gameplay/shooter.config.js +26 -0
  99. package/templates/create/2d/content/gameplay/waves.json +26 -0
  100. package/templates/create/2d/content/registries/.gitkeep +1 -0
  101. package/templates/create/2d/docs/design/.gitkeep +1 -0
  102. package/templates/create/2d/docs/design/loop.md +5 -0
  103. package/templates/create/2d/prefabs/enemies.prefab.js +90 -0
  104. package/templates/create/2d/prefabs/enemy-basic.prefab.js +18 -0
  105. package/templates/create/2d/prefabs/player.prefab.js +36 -0
  106. package/templates/create/2d/prefabs/projectiles.prefab.js +35 -0
  107. package/templates/create/2d/scenes/boot.scene.js +12 -0
  108. package/templates/create/2d/scenes/gameplay.scene.js +230 -0
  109. package/templates/create/2d/scenes/menu.scene.js +9 -0
  110. package/templates/create/2d/src/main.js +6 -185
  111. package/templates/create/2d/src/runtime/app.js +49 -0
  112. package/templates/create/2d/src/runtime/capabilities.js +35 -0
  113. package/templates/create/2d/ui/hud.screen.js +40 -0
  114. package/templates/create/2d/ui/pause.screen.js +149 -0
  115. package/templates/create/2d/ui/settings.screen.js +347 -0
  116. package/templates/create/2d/ui/title.screen.js +13 -0
  117. package/templates/create/2d-adventure/aura.config.json +28 -0
  118. package/templates/create/2d-adventure/config/gameplay/adventure.config.js +14 -0
  119. package/templates/create/2d-adventure/content/gameplay/world.js +46 -0
  120. package/templates/create/2d-adventure/content/registries/.gitkeep +1 -0
  121. package/templates/create/2d-adventure/docs/design/loop.md +5 -0
  122. package/templates/create/2d-adventure/prefabs/player.prefab.js +54 -0
  123. package/templates/create/2d-adventure/prefabs/relic.prefab.js +38 -0
  124. package/templates/create/2d-adventure/prefabs/world.prefab.js +125 -0
  125. package/templates/create/2d-adventure/scenes/gameplay.scene.js +256 -0
  126. package/templates/create/2d-adventure/src/runtime/capabilities.js +34 -0
  127. package/templates/create/2d-adventure/ui/hud.screen.js +60 -0
  128. package/templates/create/2d-survivor/config/gameplay/survivor.config.js +33 -0
  129. package/templates/create/2d-survivor/content/gameplay/spawn-zones.json +29 -0
  130. package/templates/create/2d-survivor/content/registries/.gitkeep +1 -0
  131. package/templates/create/2d-survivor/docs/design/.gitkeep +1 -0
  132. package/templates/create/2d-survivor/docs/design/loop.md +5 -0
  133. package/templates/create/2d-survivor/prefabs/enemies.prefab.js +178 -0
  134. package/templates/create/2d-survivor/prefabs/enemy-swarm.prefab.js +18 -0
  135. package/templates/create/2d-survivor/prefabs/player.prefab.js +42 -0
  136. package/templates/create/2d-survivor/prefabs/projectiles.prefab.js +56 -0
  137. package/templates/create/2d-survivor/scenes/boot.scene.js +12 -0
  138. package/templates/create/2d-survivor/scenes/gameplay.scene.js +314 -0
  139. package/templates/create/2d-survivor/scenes/menu.scene.js +9 -0
  140. package/templates/create/2d-survivor/src/main.js +5 -332
  141. package/templates/create/2d-survivor/src/runtime/app.js +49 -0
  142. package/templates/create/2d-survivor/src/runtime/capabilities.js +35 -0
  143. package/templates/create/2d-survivor/ui/hud.screen.js +45 -0
  144. package/templates/create/2d-survivor/ui/title.screen.js +13 -0
  145. package/templates/create/3d/assets/models/starter-avatar.gltf +184 -0
  146. package/templates/create/3d/config/gameplay/.gitkeep +1 -0
  147. package/templates/create/3d/content/gameplay/checkpoints.json +33 -0
  148. package/templates/create/3d/content/gameplay/course.js +40 -0
  149. package/templates/create/3d/content/registries/.gitkeep +1 -0
  150. package/templates/create/3d/docs/design/.gitkeep +1 -0
  151. package/templates/create/3d/docs/design/loop.md +5 -0
  152. package/templates/create/3d/prefabs/checkpoint.prefab.js +15 -0
  153. package/templates/create/3d/prefabs/player.prefab.js +204 -0
  154. package/templates/create/3d/prefabs/world.prefab.js +112 -0
  155. package/templates/create/3d/scenes/boot.scene.js +12 -0
  156. package/templates/create/3d/scenes/checkpoint.scene.js +9 -0
  157. package/templates/create/3d/scenes/gameplay.scene.js +292 -0
  158. package/templates/create/3d/src/main.js +6 -295
  159. package/templates/create/3d/src/runtime/app.js +49 -0
  160. package/templates/create/3d/src/runtime/capabilities.js +53 -0
  161. package/templates/create/3d/src/runtime/materials.js +34 -0
  162. package/templates/create/3d/src/runtime/state.js +39 -0
  163. package/templates/create/3d/ui/hud.screen.js +75 -0
  164. package/templates/create/3d/ui/pause.screen.js +166 -0
  165. package/templates/create/3d/ui/settings.screen.js +387 -0
  166. package/templates/create/3d-adventure/assets/models/starter-avatar.gltf +184 -0
  167. package/templates/create/3d-adventure/aura.config.json +28 -0
  168. package/templates/create/3d-adventure/config/gameplay/adventure.config.js +9 -0
  169. package/templates/create/3d-adventure/content/gameplay/course.js +62 -0
  170. package/templates/create/3d-adventure/content/registries/.gitkeep +1 -0
  171. package/templates/create/3d-adventure/docs/design/loop.md +5 -0
  172. package/templates/create/3d-adventure/prefabs/player.prefab.js +168 -0
  173. package/templates/create/3d-adventure/prefabs/relic.prefab.js +35 -0
  174. package/templates/create/3d-adventure/prefabs/world.prefab.js +119 -0
  175. package/templates/create/3d-adventure/scenes/gameplay.scene.js +358 -0
  176. package/templates/create/3d-adventure/src/runtime/capabilities.js +56 -0
  177. package/templates/create/3d-adventure/src/runtime/materials.js +39 -0
  178. package/templates/create/3d-adventure/src/runtime/state.js +31 -0
  179. package/templates/create/3d-adventure/ui/hud.screen.js +70 -0
  180. package/templates/create/3d-adventure/ui/pause.screen.js +437 -0
  181. package/templates/create/3d-collectathon/assets/models/starter-avatar.gltf +184 -0
  182. package/templates/create/3d-collectathon/config/gameplay/.gitkeep +1 -0
  183. package/templates/create/3d-collectathon/content/gameplay/collectibles.json +26 -0
  184. package/templates/create/3d-collectathon/content/gameplay/course.js +46 -0
  185. package/templates/create/3d-collectathon/content/registries/.gitkeep +1 -0
  186. package/templates/create/3d-collectathon/docs/design/.gitkeep +1 -0
  187. package/templates/create/3d-collectathon/docs/design/loop.md +5 -0
  188. package/templates/create/3d-collectathon/prefabs/collectible.prefab.js +15 -0
  189. package/templates/create/3d-collectathon/prefabs/player.prefab.js +207 -0
  190. package/templates/create/3d-collectathon/prefabs/world.prefab.js +112 -0
  191. package/templates/create/3d-collectathon/scenes/boot.scene.js +12 -0
  192. package/templates/create/3d-collectathon/scenes/checkpoint.scene.js +9 -0
  193. package/templates/create/3d-collectathon/scenes/gameplay.scene.js +200 -0
  194. package/templates/create/3d-collectathon/src/main.js +5 -355
  195. package/templates/create/3d-collectathon/src/runtime/app.js +49 -0
  196. package/templates/create/3d-collectathon/src/runtime/capabilities.js +53 -0
  197. package/templates/create/3d-collectathon/src/runtime/materials.js +34 -0
  198. package/templates/create/3d-collectathon/src/runtime/state.js +27 -0
  199. package/templates/create/3d-collectathon/ui/hud.screen.js +66 -0
  200. package/templates/create/3d-collectathon/ui/pause.screen.js +13 -0
  201. package/templates/create/blank/config/gameplay/.gitkeep +1 -0
  202. package/templates/create/blank/content/gameplay/.gitkeep +1 -0
  203. package/templates/create/blank/content/registries/.gitkeep +1 -0
  204. package/templates/create/blank/docs/design/.gitkeep +1 -0
  205. package/templates/create/blank/docs/design/loop.md +5 -0
  206. package/templates/create/blank/prefabs/.gitkeep +1 -0
  207. package/templates/create/blank/scenes/.gitkeep +1 -0
  208. package/templates/create/blank/src/runtime/.gitkeep +1 -0
  209. package/templates/create/blank/ui/.gitkeep +1 -0
  210. package/templates/create/deckbuilder-2d/assets/audio/.gitkeep +1 -0
  211. package/templates/create/deckbuilder-2d/assets/fonts/.gitkeep +1 -0
  212. package/templates/create/deckbuilder-2d/assets/sprites/.gitkeep +1 -0
  213. package/templates/create/deckbuilder-2d/assets/starter/README.md +11 -0
  214. package/templates/create/deckbuilder-2d/assets/ui/.gitkeep +1 -0
  215. package/templates/create/deckbuilder-2d/aura.config.json +28 -0
  216. package/templates/create/deckbuilder-2d/config/gameplay/deckbuilder.config.js +26 -0
  217. package/templates/create/deckbuilder-2d/content/cards/guard.card.js +19 -0
  218. package/templates/create/deckbuilder-2d/content/cards/spark.card.js +20 -0
  219. package/templates/create/deckbuilder-2d/content/cards/starter.deck.js +69 -0
  220. package/templates/create/deckbuilder-2d/content/cards/strike.card.js +19 -0
  221. package/templates/create/deckbuilder-2d/content/cards/survey.card.js +20 -0
  222. package/templates/create/deckbuilder-2d/content/encounters/training-battle.encounter.js +14 -0
  223. package/templates/create/deckbuilder-2d/content/encounters/training-battle.js +65 -0
  224. package/templates/create/deckbuilder-2d/content/enemies/training-automaton.enemy.js +48 -0
  225. package/templates/create/deckbuilder-2d/content/gameplay/.gitkeep +1 -0
  226. package/templates/create/deckbuilder-2d/content/registries/cards.registry.js +26 -0
  227. package/templates/create/deckbuilder-2d/content/registries/encounters.registry.js +20 -0
  228. package/templates/create/deckbuilder-2d/content/registries/enemies.registry.js +20 -0
  229. package/templates/create/deckbuilder-2d/content/registries/relics.registry.js +20 -0
  230. package/templates/create/deckbuilder-2d/content/relics/ember-charm.relic.js +18 -0
  231. package/templates/create/deckbuilder-2d/docs/design/loop.md +12 -0
  232. package/templates/create/deckbuilder-2d/prefabs/.gitkeep +1 -0
  233. package/templates/create/deckbuilder-2d/scenes/boot.scene.js +84 -0
  234. package/templates/create/deckbuilder-2d/scenes/gameplay.scene.js +641 -0
  235. package/templates/create/deckbuilder-2d/src/components/.gitkeep +1 -0
  236. package/templates/create/deckbuilder-2d/src/main.js +17 -0
  237. package/templates/create/deckbuilder-2d/src/runtime/capabilities.js +22 -0
  238. package/templates/create/deckbuilder-2d/src/shared/.gitkeep +1 -0
  239. package/templates/create/deckbuilder-2d/src/systems/.gitkeep +1 -0
  240. package/templates/create/deckbuilder-2d/tests/smoke/.gitkeep +1 -0
  241. package/templates/create/deckbuilder-2d/ui/hud.screen.js +80 -0
  242. package/templates/create/deckbuilder-2d/ui/pause.screen.js +146 -0
  243. package/templates/create/deckbuilder-2d/ui/settings.screen.js +342 -0
  244. package/templates/create/local-multiplayer/aura.config.json +40 -0
  245. package/templates/create/local-multiplayer/config/gameplay/local-multiplayer.config.js +26 -0
  246. package/templates/create/local-multiplayer/content/gameplay/room-layout.js +13 -0
  247. package/templates/create/local-multiplayer/content/registries/.gitkeep +1 -0
  248. package/templates/create/local-multiplayer/docs/design/loop.md +14 -0
  249. package/templates/create/local-multiplayer/prefabs/player.prefab.js +99 -0
  250. package/templates/create/local-multiplayer/scenes/boot.scene.js +12 -0
  251. package/templates/create/local-multiplayer/scenes/gameplay.scene.js +443 -0
  252. package/templates/create/local-multiplayer/src/main.js +17 -0
  253. package/templates/create/local-multiplayer/src/runtime/capabilities.js +28 -0
  254. package/templates/create/local-multiplayer/ui/hud.screen.js +60 -0
  255. package/templates/create/shared/src/runtime/project-inspector.js +105 -0
  256. package/templates/create/shared/src/runtime/scene-flow.js +290 -0
  257. package/templates/create/shared/src/runtime/screen-shell.js +222 -0
  258. package/templates/create/shared/src/runtime/ui-forms.js +209 -0
  259. package/templates/create/shared/src/runtime/ui-settings.js +237 -0
  260. package/templates/create/shared/src/runtime/ui-theme.js +352 -0
  261. package/templates/create/shared/src/starter-utils/adventure-objectives.js +102 -0
  262. package/templates/create/shared/src/starter-utils/animation-2d.js +337 -0
  263. package/templates/create/shared/src/starter-utils/avatar-3d.js +404 -0
  264. package/templates/create/shared/src/starter-utils/combat-feedback-2d.js +320 -0
  265. package/templates/create/shared/src/starter-utils/core.js +39 -3
  266. package/templates/create/shared/src/starter-utils/index.js +8 -2
  267. package/templates/create/shared/src/starter-utils/platformer-3d.js +34 -3
  268. package/templates/create/shared/src/starter-utils/triggers.js +662 -0
  269. package/templates/create/shared/src/starter-utils/tween-2d.js +615 -0
  270. package/templates/create/video-cutscene/assets/video/.gitkeep +0 -0
  271. package/templates/create/video-cutscene/aura.config.json +28 -0
  272. package/templates/create/video-cutscene/config/gameplay/.gitkeep +0 -0
  273. package/templates/create/video-cutscene/content/gameplay/.gitkeep +0 -0
  274. package/templates/create/video-cutscene/content/registries/.gitkeep +0 -0
  275. package/templates/create/video-cutscene/docs/design/loop.md +22 -0
  276. package/templates/create/video-cutscene/prefabs/.gitkeep +0 -0
  277. package/templates/create/video-cutscene/scenes/boot.scene.js +11 -0
  278. package/templates/create/video-cutscene/scenes/cutscene.scene.js +113 -0
  279. package/templates/create/video-cutscene/scenes/gameplay.scene.js +50 -0
  280. package/templates/create/video-cutscene/src/main.js +17 -0
  281. package/templates/create/video-cutscene/src/runtime/app.js +52 -0
  282. package/templates/create/video-cutscene/src/runtime/capabilities.js +35 -0
  283. package/templates/create/video-cutscene/src/runtime/state.js +13 -0
  284. package/templates/create/video-cutscene/ui/.gitkeep +0 -0
  285. package/templates/create-bin/play.js +1187 -0
  286. package/templates/make/README.md +46 -0
  287. package/templates/make/catalog.json +51 -0
  288. package/templates/make/component/files/{{MAKE_NAME}}.component.js +20 -0
  289. package/templates/make/component/manifest.json +9 -0
  290. package/templates/make/data/files/{{MAKE_NAME}}.json +14 -0
  291. package/templates/make/data/manifest.json +9 -0
  292. package/templates/make/material/files/{{MAKE_NAME}}.material.json +17 -0
  293. package/templates/make/material/manifest.json +9 -0
  294. package/templates/make/prefab/files/{{MAKE_NAME}}.prefab.js +20 -0
  295. package/templates/make/prefab/manifest.json +9 -0
  296. package/templates/make/scene/files/{{MAKE_NAME}}.scene.js +31 -0
  297. package/templates/make/scene/manifest.json +9 -0
  298. package/templates/make/shader/files/{{MAKE_NAME}}.shader.js +23 -0
  299. package/templates/make/shader/manifest.json +9 -0
  300. package/templates/make/system/files/{{MAKE_NAME}}.system.js +15 -0
  301. package/templates/make/system/manifest.json +9 -0
  302. package/templates/make/ui-screen/files/{{MAKE_NAME}}.screen.js +16 -0
  303. package/templates/make/ui-screen/files/{{MAKE_NAME}}.screen.json +23 -0
  304. package/templates/make/ui-screen/manifest.json +10 -0
  305. package/templates/make-starters/deckbuilder-2d/card/files/{{MAKE_NAME}}.card.js +22 -0
  306. package/templates/make-starters/deckbuilder-2d/card/manifest.json +9 -0
  307. package/templates/make-starters/deckbuilder-2d/catalog.json +34 -0
  308. package/templates/make-starters/deckbuilder-2d/encounter/files/{{MAKE_NAME}}.encounter.js +18 -0
  309. package/templates/make-starters/deckbuilder-2d/encounter/manifest.json +9 -0
  310. package/templates/make-starters/deckbuilder-2d/enemy/files/{{MAKE_NAME}}.enemy.js +28 -0
  311. package/templates/make-starters/deckbuilder-2d/enemy/manifest.json +9 -0
  312. package/templates/make-starters/deckbuilder-2d/relic/files/{{MAKE_NAME}}.relic.js +23 -0
  313. package/templates/make-starters/deckbuilder-2d/relic/manifest.json +9 -0
  314. package/templates/retro/platformer/README.md +10 -0
  315. package/templates/retro/platformer/assets/retro/assets.json +91 -0
  316. package/templates/retro/platformer/aura.config.json +7 -0
  317. package/templates/retro/platformer/package.json +5 -0
  318. package/templates/retro/platformer/src/main.js +40 -0
  319. package/templates/retro/puzzle-grid/README.md +10 -0
  320. package/templates/retro/puzzle-grid/assets/retro/assets.json +90 -0
  321. package/templates/retro/puzzle-grid/aura.config.json +7 -0
  322. package/templates/retro/puzzle-grid/package.json +5 -0
  323. package/templates/retro/puzzle-grid/src/main.js +29 -0
  324. package/templates/retro/tactics-grid/README.md +10 -0
  325. package/templates/retro/tactics-grid/assets/retro/assets.json +90 -0
  326. package/templates/retro/tactics-grid/aura.config.json +7 -0
  327. package/templates/retro/tactics-grid/package.json +5 -0
  328. package/templates/retro/tactics-grid/src/main.js +35 -0
  329. package/templates/retro/topdown-adventure/README.md +10 -0
  330. package/templates/retro/topdown-adventure/assets/retro/assets.json +95 -0
  331. package/templates/retro/topdown-adventure/aura.config.json +7 -0
  332. package/templates/retro/topdown-adventure/package.json +5 -0
  333. package/templates/retro/topdown-adventure/src/main.js +29 -0
  334. package/templates/skills/aurajs/SKILL.md +61 -5
@@ -0,0 +1,178 @@
1
+ import { pickEnemyArchetypeForWave2D, spawnEnemy2D } from '../src/starter-utils/index.js';
2
+
3
+ const enemiesPrefab = {
4
+ id: 'enemies',
5
+ kind: 'prefab',
6
+ role: 'enemy',
7
+ view: {
8
+ kind: 'actor2d',
9
+ },
10
+ hooks: {},
11
+ notes: ['Starter enemy helpers still live beside the authored prefab descriptor in this template.'],
12
+ };
13
+
14
+ function distanceSquared2D(ax, ay, bx, by) {
15
+ const dx = ax - bx;
16
+ const dy = ay - by;
17
+ return (dx * dx) + (dy * dy);
18
+ }
19
+
20
+ export function spawnEnemyOnEdge(width, height, waveState, config) {
21
+ const side = Math.floor(Math.random() * 4);
22
+ let x = width * 0.5;
23
+ let y = height * 0.5;
24
+
25
+ if (side === 0) {
26
+ x = Math.random() * width;
27
+ y = -config.spawnPadding;
28
+ } else if (side === 1) {
29
+ x = width + config.spawnPadding;
30
+ y = Math.random() * height;
31
+ } else if (side === 2) {
32
+ x = Math.random() * width;
33
+ y = height + config.spawnPadding;
34
+ } else {
35
+ x = -config.spawnPadding;
36
+ y = Math.random() * height;
37
+ }
38
+
39
+ const wave = waveState?.wave || null;
40
+ const archetypeId = wave?.archetype || pickEnemyArchetypeForWave2D(waveState?.waveIndex || 0).id;
41
+ const enemy = spawnEnemy2D({
42
+ x,
43
+ y,
44
+ waveIndex: waveState?.waveIndex || 0,
45
+ archetypeId,
46
+ });
47
+
48
+ const hpScale = Number.isFinite(Number(wave?.hpScale)) ? Number(wave.hpScale) : 1.0;
49
+ const speedScale = Number.isFinite(Number(wave?.speedScale)) ? Number(wave.speedScale) : 1.0;
50
+ enemy.hp = Math.max(1, Math.round((enemy.size / 14) * hpScale));
51
+ enemy.speed = Math.max(60, enemy.speed * speedScale);
52
+ return enemy;
53
+ }
54
+
55
+ export function nearestEnemyToPlayer(player, enemies) {
56
+ if (enemies.length === 0) return null;
57
+
58
+ let best = enemies[0];
59
+ let bestDistance = distanceSquared2D(player.x, player.y, best.x, best.y);
60
+
61
+ for (let index = 1; index < enemies.length; index += 1) {
62
+ const candidate = enemies[index];
63
+ const candidateDistance = distanceSquared2D(player.x, player.y, candidate.x, candidate.y);
64
+ if (candidateDistance < bestDistance) {
65
+ best = candidate;
66
+ bestDistance = candidateDistance;
67
+ }
68
+ }
69
+
70
+ return best;
71
+ }
72
+
73
+ export function updateEnemyMovement(player, enemies, dt) {
74
+ for (const enemy of enemies) {
75
+ const dx = player.x - enemy.x;
76
+ const dy = player.y - enemy.y;
77
+ const magnitude = Math.hypot(dx, dy) || 1;
78
+ enemy.x += (dx / magnitude) * enemy.speed * dt;
79
+ enemy.y += (dy / magnitude) * enemy.speed * dt;
80
+ }
81
+ }
82
+
83
+ export function resolveBulletHits(bullets, enemies, config) {
84
+ const nextBullets = bullets.slice();
85
+ const nextEnemies = enemies.slice();
86
+ const impactEvents = [];
87
+ let scoreDelta = 0;
88
+
89
+ for (let bulletIndex = nextBullets.length - 1; bulletIndex >= 0; bulletIndex -= 1) {
90
+ const bullet = nextBullets[bulletIndex];
91
+ let consumed = false;
92
+
93
+ for (let enemyIndex = nextEnemies.length - 1; enemyIndex >= 0; enemyIndex -= 1) {
94
+ const enemy = nextEnemies[enemyIndex];
95
+ const enemyRadius = enemy.size * 0.46;
96
+ const hitRadius = enemyRadius + (config.bulletSize * 0.5);
97
+ const hitDistanceSq = distanceSquared2D(bullet.x, bullet.y, enemy.x, enemy.y);
98
+ if (hitDistanceSq > (hitRadius * hitRadius)) continue;
99
+
100
+ enemy.hp -= 1;
101
+ impactEvents.push({
102
+ x: enemy.x,
103
+ y: enemy.y,
104
+ defeated: enemy.hp <= 0,
105
+ scoreValue: enemy.scoreValue,
106
+ color: enemy.color,
107
+ });
108
+ nextBullets.splice(bulletIndex, 1);
109
+ consumed = true;
110
+ if (enemy.hp <= 0) {
111
+ scoreDelta += enemy.scoreValue;
112
+ nextEnemies.splice(enemyIndex, 1);
113
+ }
114
+ break;
115
+ }
116
+
117
+ if (consumed) continue;
118
+ }
119
+
120
+ return {
121
+ bullets: nextBullets,
122
+ enemies: nextEnemies,
123
+ scoreDelta,
124
+ impactEvents,
125
+ };
126
+ }
127
+
128
+ export function resolvePlayerContacts(player, enemies, config, touchInvulnerabilityRemaining, health) {
129
+ if (touchInvulnerabilityRemaining > 0) {
130
+ return {
131
+ enemies,
132
+ health,
133
+ invulnerability: touchInvulnerabilityRemaining,
134
+ playerHit: false,
135
+ contactPoint: null,
136
+ gameOver: health <= 0,
137
+ };
138
+ }
139
+
140
+ const nextEnemies = enemies.slice();
141
+ let nextHealth = health;
142
+ let nextInvulnerability = 0;
143
+ let playerHit = false;
144
+ let contactPoint = null;
145
+
146
+ for (let index = nextEnemies.length - 1; index >= 0; index -= 1) {
147
+ const enemy = nextEnemies[index];
148
+ const enemyRadius = enemy.size * 0.44;
149
+ const touchRadius = enemyRadius + config.playerTouchRadius;
150
+ const distanceSq = distanceSquared2D(player.x, player.y, enemy.x, enemy.y);
151
+ if (distanceSq > (touchRadius * touchRadius)) continue;
152
+
153
+ nextEnemies.splice(index, 1);
154
+ nextHealth -= 1;
155
+ nextInvulnerability = config.enemyHitInvulnerabilitySeconds;
156
+ playerHit = true;
157
+ contactPoint = { x: enemy.x, y: enemy.y };
158
+ break;
159
+ }
160
+
161
+ return {
162
+ enemies: nextEnemies,
163
+ health: nextHealth,
164
+ invulnerability: nextInvulnerability,
165
+ playerHit,
166
+ contactPoint,
167
+ gameOver: nextHealth <= 0,
168
+ };
169
+ }
170
+
171
+ export function drawEnemies(enemies) {
172
+ for (const enemy of enemies) {
173
+ const half = enemy.size * 0.5;
174
+ aura.draw2d.rect(enemy.x - half, enemy.y - half, enemy.size, enemy.size, aura.rgb(enemy.color.r, enemy.color.g, enemy.color.b));
175
+ }
176
+ }
177
+
178
+ export default enemiesPrefab;
@@ -0,0 +1,18 @@
1
+ const enemySwarmPrefab = {
2
+ id: 'enemy-swarm',
3
+ kind: 'prefab',
4
+ role: 'enemy',
5
+ view: { kind: 'actor2d' },
6
+ components: {
7
+ archetype: 'swarm',
8
+ behaviorRole: 'surround',
9
+ },
10
+ hooks: {},
11
+ notes: ['Move survivor-specific spawn tuning here before adding more enemy classes.'],
12
+ };
13
+
14
+ export function createEnemySwarmPrefab() {
15
+ return enemySwarmPrefab;
16
+ }
17
+
18
+ export default enemySwarmPrefab;
@@ -0,0 +1,42 @@
1
+ const playerPrefab = {
2
+ id: 'player',
3
+ kind: 'prefab',
4
+ role: 'player',
5
+ view: {
6
+ kind: 'actor2d',
7
+ collider: { shape: 'rect', size: { x: 28, y: 28 } },
8
+ },
9
+ hooks: {},
10
+ notes: ['Keep authored spawn/state ownership here even while the starter stays JS-first.'],
11
+ };
12
+
13
+ export function createPlayerPrefab() {
14
+ return playerPrefab;
15
+ }
16
+
17
+ export function createPlayerState() {
18
+ return { x: 0, y: 0 };
19
+ }
20
+
21
+ export function resetPlayerPosition(player, size) {
22
+ player.x = size.width * 0.5;
23
+ player.y = size.height * 0.5;
24
+ }
25
+
26
+ export function drawPlayer(player, config, dashTimer, touchInvulnerabilityRemaining, hitFlashVisible = false) {
27
+ const playerColor = hitFlashVisible
28
+ ? aura.rgb(1.0, 0.98, 0.72)
29
+ : (touchInvulnerabilityRemaining > 0
30
+ ? aura.rgb(1.0, 0.72, 0.72)
31
+ : (dashTimer > 0 ? aura.rgb(0.6, 1.0, 0.82) : aura.rgb(0.4, 0.84, 1.0)));
32
+
33
+ aura.draw2d.rect(
34
+ player.x - (config.playerSize * 0.5),
35
+ player.y - (config.playerSize * 0.5),
36
+ config.playerSize,
37
+ config.playerSize,
38
+ playerColor,
39
+ );
40
+ }
41
+
42
+ export default playerPrefab;
@@ -0,0 +1,56 @@
1
+ const projectilesPrefab = {
2
+ id: 'projectiles',
3
+ kind: 'prefab',
4
+ role: 'custom',
5
+ view: {
6
+ kind: 'actor2d',
7
+ },
8
+ hooks: {},
9
+ notes: ['Starter projectile helpers still live beside the authored prefab descriptor in this template.'],
10
+ };
11
+
12
+ export function fireAutoBullet(player, target, config) {
13
+ if (!target) return null;
14
+ const dx = target.x - player.x;
15
+ const dy = target.y - player.y;
16
+ const magnitude = Math.hypot(dx, dy) || 1;
17
+
18
+ return {
19
+ x: player.x,
20
+ y: player.y,
21
+ vx: (dx / magnitude) * config.bulletSpeed,
22
+ vy: (dy / magnitude) * config.bulletSpeed,
23
+ ttl: config.bulletLifetimeSeconds,
24
+ };
25
+ }
26
+
27
+ export function updateBullets(bullets, dt) {
28
+ for (const bullet of bullets) {
29
+ bullet.x += bullet.vx * dt;
30
+ bullet.y += bullet.vy * dt;
31
+ bullet.ttl -= dt;
32
+ }
33
+ }
34
+
35
+ export function pruneBullets(bullets, size) {
36
+ return bullets.filter((bullet) => {
37
+ if (bullet.ttl <= 0) return false;
38
+ if (bullet.x < -24 || bullet.y < -24) return false;
39
+ if (bullet.x > size.width + 24 || bullet.y > size.height + 24) return false;
40
+ return true;
41
+ });
42
+ }
43
+
44
+ export function drawBullets(bullets, config) {
45
+ for (const bullet of bullets) {
46
+ aura.draw2d.rect(
47
+ bullet.x - (config.bulletSize * 0.5),
48
+ bullet.y - (config.bulletSize * 0.5),
49
+ config.bulletSize,
50
+ config.bulletSize,
51
+ aura.rgb(1.0, 0.94, 0.72),
52
+ );
53
+ }
54
+ }
55
+
56
+ export default projectilesPrefab;
@@ -0,0 +1,12 @@
1
+ export function createBootScene() {
2
+ return {
3
+ id: 'boot',
4
+ template: "2d-survivor",
5
+ nextSceneId: 'gameplay',
6
+ notes: [
7
+ 'Use this scene for splash, loading, title flow, and session handoff.',
8
+ 'Keep long-lived boot orchestration here instead of bloating src/main.js.',
9
+ 'Keep save or checkpoint resume handoff in src/runtime and appState instead of ad hoc globals.',
10
+ ],
11
+ };
12
+ }
@@ -0,0 +1,314 @@
1
+ import {
2
+ axisFromKeys,
3
+ clamp,
4
+ consumeCooldown,
5
+ createCooldown,
6
+ createFloatingTextLayer2D,
7
+ createHitFlash2D,
8
+ createHitSparkLayer2D,
9
+ createWaveDirector,
10
+ drawFloatingTextLayer2D,
11
+ drawHitSparkLayer2D,
12
+ isHitFlashVisible2D,
13
+ spawnFloatingText2D,
14
+ spawnHitSpark2D,
15
+ stepWaveDirector,
16
+ stepFloatingTextLayer2D,
17
+ stepHitFlash2D,
18
+ stepHitSparkLayer2D,
19
+ tickCooldown,
20
+ triggerHitFlash2D,
21
+ } from '../src/starter-utils/index.js';
22
+ import { SURVIVOR_CONFIG, SURVIVOR_TEXT, SURVIVOR_WAVES } from '../config/gameplay/survivor.config.js';
23
+ import {
24
+ createPlayerState,
25
+ drawPlayer,
26
+ resetPlayerPosition,
27
+ } from '../prefabs/player.prefab.js';
28
+ import {
29
+ drawEnemies,
30
+ nearestEnemyToPlayer,
31
+ resolveBulletHits,
32
+ resolvePlayerContacts,
33
+ spawnEnemyOnEdge,
34
+ updateEnemyMovement,
35
+ } from '../prefabs/enemies.prefab.js';
36
+ import {
37
+ drawBullets,
38
+ fireAutoBullet,
39
+ pruneBullets,
40
+ updateBullets,
41
+ } from '../prefabs/projectiles.prefab.js';
42
+ import { ensureUiState } from '../src/runtime/app-state.js';
43
+ import { drawSurvivorHud } from '../ui/hud.screen.js';
44
+
45
+ function createSurvivorSessionSeed() {
46
+ return {
47
+ runsStarted: 0,
48
+ bestScore: 0,
49
+ bestTimeSeconds: 0,
50
+ lastOutcome: 'idle',
51
+ lastSceneId: 'gameplay',
52
+ };
53
+ }
54
+
55
+ function ensureSurvivorSession(context, appState) {
56
+ if (typeof context.ensureSessionState === 'function') {
57
+ return context.ensureSessionState('survivor', createSurvivorSessionSeed());
58
+ }
59
+ if (!appState.session || typeof appState.session !== 'object' || Array.isArray(appState.session)) {
60
+ appState.session = {};
61
+ }
62
+ if (!appState.session.survivor || typeof appState.session.survivor !== 'object' || Array.isArray(appState.session.survivor)) {
63
+ appState.session.survivor = createSurvivorSessionSeed();
64
+ }
65
+ return appState.session.survivor;
66
+ }
67
+
68
+ function createSurvivorUiStateSeed() {
69
+ return {
70
+ showControlsHint: true,
71
+ };
72
+ }
73
+
74
+ function ensureSurvivorUiState(context, appState) {
75
+ if (typeof context.ensureUiState === 'function') {
76
+ return context.ensureUiState('survivorHud', createSurvivorUiStateSeed());
77
+ }
78
+ if (!appState.ui || typeof appState.ui !== 'object' || Array.isArray(appState.ui)) {
79
+ appState.ui = {};
80
+ }
81
+ if (!appState.ui.survivorHud || typeof appState.ui.survivorHud !== 'object' || Array.isArray(appState.ui.survivorHud)) {
82
+ appState.ui.survivorHud = createSurvivorUiStateSeed();
83
+ }
84
+ return appState.ui.survivorHud;
85
+ }
86
+
87
+ export function createGameplayScene(context = {}) {
88
+ const appState = context.appState || {};
89
+ const survivorSession = ensureSurvivorSession(context, appState);
90
+ const survivorUiState = ensureSurvivorUiState(context, appState);
91
+ const sceneState = {
92
+ player: createPlayerState(),
93
+ bullets: [],
94
+ enemies: [],
95
+ score: 0,
96
+ elapsed: 0,
97
+ health: SURVIVOR_CONFIG.startingHealth,
98
+ gameOver: false,
99
+ shotCooldown: createCooldown(SURVIVOR_CONFIG.autoFireCooldownSeconds),
100
+ dashCooldown: createCooldown(SURVIVOR_CONFIG.dashCooldownSeconds),
101
+ touchInvulnerability: createCooldown(SURVIVOR_CONFIG.enemyHitInvulnerabilitySeconds),
102
+ dashTimer: 0,
103
+ floatingText: createFloatingTextLayer2D(),
104
+ hitSparks: createHitSparkLayer2D(),
105
+ playerHitFlash: createHitFlash2D(),
106
+ spawnDirector: createWaveDirector({
107
+ waves: SURVIVOR_WAVES,
108
+ loop: true,
109
+ betweenWaveDelay: SURVIVOR_CONFIG.betweenWaveDelaySeconds,
110
+ }),
111
+ };
112
+
113
+ function syncSessionState() {
114
+ survivorSession.lastSceneId = 'gameplay';
115
+ survivorSession.bestScore = Math.max(Number(survivorSession.bestScore || 0), sceneState.score);
116
+ survivorSession.bestTimeSeconds = Math.max(Number(survivorSession.bestTimeSeconds || 0), sceneState.elapsed);
117
+ survivorSession.lastScore = sceneState.score;
118
+ survivorSession.lastElapsedSeconds = Number(sceneState.elapsed.toFixed(2));
119
+ survivorSession.lastHealth = sceneState.health;
120
+ survivorSession.lastOutcome = sceneState.gameOver ? 'game-over' : 'running';
121
+ }
122
+
123
+ function resetRun() {
124
+ resetPlayerPosition(sceneState.player, aura.window.getSize());
125
+ sceneState.bullets = [];
126
+ sceneState.enemies = [];
127
+ sceneState.score = 0;
128
+ sceneState.elapsed = 0;
129
+ sceneState.health = SURVIVOR_CONFIG.startingHealth;
130
+ sceneState.gameOver = false;
131
+ sceneState.dashTimer = 0;
132
+ sceneState.shotCooldown = createCooldown(SURVIVOR_CONFIG.autoFireCooldownSeconds);
133
+ sceneState.dashCooldown = createCooldown(SURVIVOR_CONFIG.dashCooldownSeconds);
134
+ sceneState.touchInvulnerability = createCooldown(SURVIVOR_CONFIG.enemyHitInvulnerabilitySeconds);
135
+ sceneState.floatingText = createFloatingTextLayer2D({
136
+ maxEntries: 24,
137
+ rise: 18,
138
+ lifetime: 0.45,
139
+ size: 14,
140
+ color: aura.Color.WHITE,
141
+ });
142
+ sceneState.hitSparks = createHitSparkLayer2D({
143
+ maxEntries: 16,
144
+ radius: 14,
145
+ innerRadius: 2,
146
+ lifetime: 0.18,
147
+ lineWidth: 2,
148
+ color: aura.rgb(1.0, 0.94, 0.48),
149
+ });
150
+ sceneState.playerHitFlash = createHitFlash2D({
151
+ duration: 0.28,
152
+ flashesPerSecond: 12,
153
+ });
154
+ sceneState.spawnDirector = createWaveDirector({
155
+ waves: SURVIVOR_WAVES,
156
+ loop: true,
157
+ betweenWaveDelay: SURVIVOR_CONFIG.betweenWaveDelaySeconds,
158
+ });
159
+ survivorSession.runsStarted += 1;
160
+ syncSessionState();
161
+ }
162
+
163
+ return {
164
+ setup() {
165
+ resetRun();
166
+ console.log(SURVIVOR_TEXT.started);
167
+ },
168
+
169
+ update(dt) {
170
+ const size = aura.window.getSize();
171
+ sceneState.elapsed += dt;
172
+ stepFloatingTextLayer2D(sceneState.floatingText, dt);
173
+ stepHitSparkLayer2D(sceneState.hitSparks, dt);
174
+ stepHitFlash2D(sceneState.playerHitFlash, dt);
175
+
176
+ if (sceneState.gameOver) {
177
+ if (aura.input.isKeyPressed('enter')) resetRun();
178
+ return;
179
+ }
180
+
181
+ tickCooldown(sceneState.shotCooldown, dt);
182
+ tickCooldown(sceneState.dashCooldown, dt);
183
+ tickCooldown(sceneState.touchInvulnerability, dt);
184
+ if (aura.input.isKeyPressed('h')) {
185
+ survivorUiState.showControlsHint = survivorUiState.showControlsHint !== true;
186
+ }
187
+
188
+ if (aura.input.isKeyPressed('shift') && consumeCooldown(sceneState.dashCooldown)) {
189
+ sceneState.dashTimer = SURVIVOR_CONFIG.dashDurationSeconds;
190
+ }
191
+ sceneState.dashTimer = Math.max(0, sceneState.dashTimer - dt);
192
+
193
+ const moveX = axisFromKeys(aura.input, ['arrowleft', 'a'], ['arrowright', 'd']);
194
+ const moveY = axisFromKeys(aura.input, ['arrowup', 'w'], ['arrowdown', 's']);
195
+ const moveSpeed = sceneState.dashTimer > 0 ? SURVIVOR_CONFIG.dashSpeed : SURVIVOR_CONFIG.moveSpeed;
196
+
197
+ sceneState.player.x += moveX * moveSpeed * dt;
198
+ sceneState.player.y += moveY * moveSpeed * dt;
199
+ sceneState.player.x = clamp(
200
+ sceneState.player.x,
201
+ SURVIVOR_CONFIG.playerSize * 0.5,
202
+ size.width - (SURVIVOR_CONFIG.playerSize * 0.5),
203
+ );
204
+ sceneState.player.y = clamp(
205
+ sceneState.player.y,
206
+ SURVIVOR_CONFIG.playerSize * 0.5,
207
+ size.height - (SURVIVOR_CONFIG.playerSize * 0.5),
208
+ );
209
+
210
+ if (consumeCooldown(sceneState.shotCooldown)) {
211
+ const bullet = fireAutoBullet(
212
+ sceneState.player,
213
+ nearestEnemyToPlayer(sceneState.player, sceneState.enemies),
214
+ SURVIVOR_CONFIG,
215
+ );
216
+ if (bullet) sceneState.bullets.push(bullet);
217
+ }
218
+
219
+ stepWaveDirector(sceneState.spawnDirector, dt, (waveState) => {
220
+ sceneState.enemies.push(spawnEnemyOnEdge(size.width, size.height, waveState, SURVIVOR_CONFIG));
221
+ });
222
+
223
+ updateBullets(sceneState.bullets, dt);
224
+ sceneState.bullets = pruneBullets(sceneState.bullets, size);
225
+
226
+ updateEnemyMovement(sceneState.player, sceneState.enemies, dt);
227
+ const hitResolution = resolveBulletHits(sceneState.bullets, sceneState.enemies, SURVIVOR_CONFIG);
228
+ sceneState.bullets = hitResolution.bullets;
229
+ sceneState.enemies = hitResolution.enemies;
230
+ sceneState.score += hitResolution.scoreDelta;
231
+ for (const impact of hitResolution.impactEvents) {
232
+ spawnHitSpark2D(sceneState.hitSparks, {
233
+ x: impact.x,
234
+ y: impact.y,
235
+ count: impact.defeated ? 7 : 5,
236
+ radius: impact.defeated ? 18 : 12,
237
+ color: impact.defeated
238
+ ? aura.rgb(1.0, 0.96, 0.56)
239
+ : aura.rgb(1.0, 0.86, 0.42),
240
+ });
241
+ spawnFloatingText2D(sceneState.floatingText, {
242
+ text: impact.defeated ? `+${impact.scoreValue}` : '-1',
243
+ x: impact.x,
244
+ y: impact.y - 10,
245
+ driftX: impact.defeated ? 4 : 0,
246
+ rise: impact.defeated ? 24 : 18,
247
+ lifetime: impact.defeated ? 0.55 : 0.4,
248
+ size: impact.defeated ? 16 : 14,
249
+ color: impact.defeated ? aura.rgb(1.0, 0.96, 0.52) : aura.Color.WHITE,
250
+ });
251
+ }
252
+
253
+ const contactResolution = resolvePlayerContacts(
254
+ sceneState.player,
255
+ sceneState.enemies,
256
+ SURVIVOR_CONFIG,
257
+ sceneState.touchInvulnerability.remaining,
258
+ sceneState.health,
259
+ );
260
+ sceneState.enemies = contactResolution.enemies;
261
+ sceneState.health = contactResolution.health;
262
+ sceneState.touchInvulnerability.remaining = contactResolution.invulnerability;
263
+ if (contactResolution.playerHit && contactResolution.contactPoint) {
264
+ triggerHitFlash2D(sceneState.playerHitFlash);
265
+ spawnHitSpark2D(sceneState.hitSparks, {
266
+ x: contactResolution.contactPoint.x,
267
+ y: contactResolution.contactPoint.y,
268
+ count: 6,
269
+ radius: 16,
270
+ color: aura.rgb(1.0, 0.52, 0.52),
271
+ });
272
+ spawnFloatingText2D(sceneState.floatingText, {
273
+ text: '-1 HP',
274
+ x: sceneState.player.x,
275
+ y: sceneState.player.y - (SURVIVOR_CONFIG.playerSize * 0.9),
276
+ driftX: 2,
277
+ rise: 22,
278
+ lifetime: 0.5,
279
+ size: 15,
280
+ color: aura.rgb(1.0, 0.52, 0.52),
281
+ });
282
+ }
283
+ if (contactResolution.gameOver) {
284
+ sceneState.gameOver = true;
285
+ }
286
+ syncSessionState();
287
+ },
288
+
289
+ draw() {
290
+ const fps = aura.window.getFPS().toFixed(0);
291
+ aura.draw2d.clear(aura.rgba(0.05, 0.05, 0.08, 1.0));
292
+ drawEnemies(sceneState.enemies);
293
+ drawHitSparkLayer2D(aura, sceneState.hitSparks);
294
+ drawBullets(sceneState.bullets, SURVIVOR_CONFIG);
295
+ drawPlayer(
296
+ sceneState.player,
297
+ SURVIVOR_CONFIG,
298
+ sceneState.dashTimer,
299
+ sceneState.touchInvulnerability.remaining,
300
+ isHitFlashVisible2D(sceneState.playerHitFlash),
301
+ );
302
+ drawFloatingTextLayer2D(aura, sceneState.floatingText);
303
+ drawSurvivorHud({
304
+ spawnDirector: sceneState.spawnDirector,
305
+ health: sceneState.health,
306
+ score: sceneState.score,
307
+ fps,
308
+ elapsed: sceneState.elapsed,
309
+ gameOver: sceneState.gameOver,
310
+ showControlsHint: survivorUiState.showControlsHint !== false,
311
+ });
312
+ },
313
+ };
314
+ }
@@ -0,0 +1,9 @@
1
+ export function createMenuScene() {
2
+ return {
3
+ id: "menu",
4
+ nextSceneId: "gameplay",
5
+ notes: [
6
+ "Use this for loadout previews, difficulty, and survivor meta UI."
7
+ ],
8
+ };
9
+ }