@playcraft/skills 0.0.2

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 (479) hide show
  1. package/README.md +333 -0
  2. package/dist/src/index.d.ts +3 -0
  3. package/dist/src/index.d.ts.map +1 -0
  4. package/dist/src/index.js +2 -0
  5. package/dist/src/index.js.map +1 -0
  6. package/dist/src/skills.loader.d.ts +31 -0
  7. package/dist/src/skills.loader.d.ts.map +1 -0
  8. package/dist/src/skills.loader.js +200 -0
  9. package/dist/src/skills.loader.js.map +1 -0
  10. package/dist/src/skills.types.d.ts +44 -0
  11. package/dist/src/skills.types.d.ts.map +1 -0
  12. package/dist/src/skills.types.js +9 -0
  13. package/dist/src/skills.types.js.map +1 -0
  14. package/package.json +35 -0
  15. package/skills/2048_core.aigameplay/SKILL.md +123 -0
  16. package/skills/2048_core.aigameplay/manifest.json +159 -0
  17. package/skills/2048_core.aigameplay/ref/pgs-schema.json +194 -0
  18. package/skills/2048_core.aigameplay/ref/reducer.template.ts +189 -0
  19. package/skills/SKILL.md +46 -0
  20. package/skills/ad_compliance_rules.aiconfig/SKILL.md +85 -0
  21. package/skills/ad_compliance_rules.aiconfig/manifest.json +60 -0
  22. package/skills/agent_remix_orchestrator.aicomponent/SKILL.md +257 -0
  23. package/skills/agent_remix_orchestrator.aicomponent/manifest.json +12 -0
  24. package/skills/app_metadata.aiconfig/SKILL.md +53 -0
  25. package/skills/app_metadata.aiconfig/manifest.json +32 -0
  26. package/skills/appear_sfx.aiaudio/SKILL.md +59 -0
  27. package/skills/appear_sfx.aiaudio/manifest.json +45 -0
  28. package/skills/appear_sfx.aiaudio/ref/appear.mp3 +0 -0
  29. package/skills/arrow_move_error_sfx.aiaudio/SKILL.md +59 -0
  30. package/skills/arrow_move_error_sfx.aiaudio/manifest.json +45 -0
  31. package/skills/arrow_move_error_sfx.aiaudio/ref/arrow_move_error.mp3 +0 -0
  32. package/skills/arrow_path_data_format.aicomponent/SKILL.md +152 -0
  33. package/skills/arrow_path_data_format.aicomponent/manifest.json +57 -0
  34. package/skills/arrow_path_data_format.aicomponent/ref/LevelParser.ts +188 -0
  35. package/skills/arrow_path_data_format.aicomponent/ref/LevelTypes.ts +131 -0
  36. package/skills/arrow_pick_match_rules.aigameplay/SKILL.md +117 -0
  37. package/skills/arrow_pick_match_rules.aigameplay/manifest.json +105 -0
  38. package/skills/arrow_pick_match_rules.aigameplay/ref/pgs-schema.json +180 -0
  39. package/skills/asset_pipeline_scripts.aicomponent/SKILL.md +117 -0
  40. package/skills/asset_pipeline_scripts.aicomponent/manifest.json +17 -0
  41. package/skills/asset_pipeline_scripts.aicomponent/ref/gen-sprite.sh +105 -0
  42. package/skills/ball_sort.aigameplay/SKILL.md +109 -0
  43. package/skills/ball_sort.aigameplay/manifest.json +155 -0
  44. package/skills/ball_sort.aigameplay/ref/pgs-schema.json +192 -0
  45. package/skills/ball_sort.aigameplay/ref/reducer.template.ts +156 -0
  46. package/skills/basketball_shot.aigameplay/SKILL.md +94 -0
  47. package/skills/basketball_shot.aigameplay/manifest.json +150 -0
  48. package/skills/basketball_shot.aigameplay/ref/pgs-schema.json +229 -0
  49. package/skills/basketball_shot.aigameplay/ref/reducer.template.ts +189 -0
  50. package/skills/bg_music.aiaudio/SKILL.md +61 -0
  51. package/skills/bg_music.aiaudio/manifest.json +48 -0
  52. package/skills/bg_music.aiaudio/ref/bg.mp3 +0 -0
  53. package/skills/big_watermelon.aigameplay/SKILL.md +94 -0
  54. package/skills/big_watermelon.aigameplay/manifest.json +155 -0
  55. package/skills/big_watermelon.aigameplay/ref/pgs-schema.json +191 -0
  56. package/skills/big_watermelon.aigameplay/ref/reducer.template.ts +202 -0
  57. package/skills/block_puzzle.aigameplay/SKILL.md +121 -0
  58. package/skills/block_puzzle.aigameplay/manifest.json +154 -0
  59. package/skills/block_puzzle.aigameplay/ref/pgs-schema.json +170 -0
  60. package/skills/block_puzzle.aigameplay/ref/reducer.template.ts +182 -0
  61. package/skills/board_entity_sprite.aiimage/SKILL.md +255 -0
  62. package/skills/board_entity_sprite.aiimage/manifest.json +153 -0
  63. package/skills/board_entity_sprite.aiimage/ref/ProceduralCar.ts +357 -0
  64. package/skills/board_entity_sprite.aiimage/ref/car.png +0 -0
  65. package/skills/board_entity_sprite.aiimage/ref/car.webp +0 -0
  66. package/skills/bottom_ui_bar.aicomponent/SKILL.md +50 -0
  67. package/skills/bottom_ui_bar.aicomponent/manifest.json +31 -0
  68. package/skills/bottom_ui_bar.aicomponent/ref/GameBottomUI.ts +27 -0
  69. package/skills/bubble_shooter.aigameplay/SKILL.md +129 -0
  70. package/skills/bubble_shooter.aigameplay/manifest.json +181 -0
  71. package/skills/bubble_shooter.aigameplay/ref/pgs-schema.json +226 -0
  72. package/skills/bubble_shooter.aigameplay/ref/reducer.template.ts +228 -0
  73. package/skills/button_click_sfx.aiaudio/SKILL.md +59 -0
  74. package/skills/button_click_sfx.aiaudio/manifest.json +45 -0
  75. package/skills/button_click_sfx.aiaudio/ref/button_click.mp3 +0 -0
  76. package/skills/calm_piano.aiaudio/SKILL.md +68 -0
  77. package/skills/calm_piano.aiaudio/manifest.json +50 -0
  78. package/skills/camera_controller_3d.aicomponent/SKILL.md +100 -0
  79. package/skills/camera_controller_3d.aicomponent/manifest.json +52 -0
  80. package/skills/camera_controller_3d.aicomponent/ref/CameraController.ts +199 -0
  81. package/skills/camera_controller_3d.aicomponent/ref/OrbitControlsAdapter.ts +152 -0
  82. package/skills/candy_tile.aiimage/SKILL.md +62 -0
  83. package/skills/candy_tile.aiimage/manifest.json +49 -0
  84. package/skills/car_parking.aigameplay/SKILL.md +105 -0
  85. package/skills/car_parking.aigameplay/manifest.json +164 -0
  86. package/skills/car_parking.aigameplay/ref/pgs-schema.json +163 -0
  87. package/skills/car_parking.aigameplay/ref/reducer.template.ts +166 -0
  88. package/skills/castle.aiimage/SKILL.md +64 -0
  89. package/skills/castle.aiimage/manifest.json +48 -0
  90. package/skills/cheerful_ukulele.aiaudio/SKILL.md +72 -0
  91. package/skills/cheerful_ukulele.aiaudio/manifest.json +50 -0
  92. package/skills/click_sfx.aiaudio/SKILL.md +59 -0
  93. package/skills/click_sfx.aiaudio/manifest.json +45 -0
  94. package/skills/click_sfx.aiaudio/ref/click.mp3 +0 -0
  95. package/skills/combo_display.aicomponent/SKILL.md +45 -0
  96. package/skills/combo_display.aicomponent/manifest.json +31 -0
  97. package/skills/combo_display.aicomponent/ref/ComboManager.ts +362 -0
  98. package/skills/combo_display.aicomponent/ref/ComboSmallUI.ts +232 -0
  99. package/skills/combo_praise_text.aicomponent/SKILL.md +56 -0
  100. package/skills/combo_praise_text.aicomponent/manifest.json +34 -0
  101. package/skills/combo_praise_text.aicomponent/ref/ComboManager.ts +362 -0
  102. package/skills/countdown_timer.aicomponent/SKILL.md +44 -0
  103. package/skills/countdown_timer.aicomponent/manifest.json +35 -0
  104. package/skills/countdown_timer.aicomponent/ref/CountdownDisplay.ts +213 -0
  105. package/skills/cta_platform_config.aiconfig/SKILL.md +72 -0
  106. package/skills/cta_platform_config.aiconfig/manifest.json +56 -0
  107. package/skills/debug_overlay.aicomponent/SKILL.md +75 -0
  108. package/skills/debug_overlay.aicomponent/manifest.json +17 -0
  109. package/skills/debug_overlay.aicomponent/ref/DebugOverlay.ts +144 -0
  110. package/skills/desert.aiimage/SKILL.md +63 -0
  111. package/skills/desert.aiimage/manifest.json +49 -0
  112. package/skills/difficulty_curve_designer.aiconfig/SKILL.md +68 -0
  113. package/skills/difficulty_curve_designer.aiconfig/manifest.json +36 -0
  114. package/skills/digit_renderer.aicomponent/SKILL.md +43 -0
  115. package/skills/digit_renderer.aicomponent/manifest.json +25 -0
  116. package/skills/digit_renderer.aicomponent/ref/DigitRenderer.ts +237 -0
  117. package/skills/download_button.aicomponent/SKILL.md +44 -0
  118. package/skills/download_button.aicomponent/manifest.json +25 -0
  119. package/skills/download_button.aicomponent/ref/DownloadButton.ts +137 -0
  120. package/skills/draw_line_puzzle.aigameplay/SKILL.md +84 -0
  121. package/skills/draw_line_puzzle.aigameplay/manifest.json +152 -0
  122. package/skills/draw_line_puzzle.aigameplay/ref/pgs-schema.json +189 -0
  123. package/skills/draw_line_puzzle.aigameplay/ref/reducer.template.ts +194 -0
  124. package/skills/easy_to_hard.aiconfig/SKILL.md +52 -0
  125. package/skills/easy_to_hard.aiconfig/manifest.json +33 -0
  126. package/skills/eight_ball_pool.aigameplay/SKILL.md +104 -0
  127. package/skills/eight_ball_pool.aigameplay/manifest.json +152 -0
  128. package/skills/eight_ball_pool.aigameplay/ref/pgs-schema.json +205 -0
  129. package/skills/eight_ball_pool.aigameplay/ref/reducer.template.ts +198 -0
  130. package/skills/energetic_electronic.aiaudio/SKILL.md +69 -0
  131. package/skills/energetic_electronic.aiaudio/manifest.json +51 -0
  132. package/skills/fail_sfx.aiaudio/SKILL.md +59 -0
  133. package/skills/fail_sfx.aiaudio/manifest.json +44 -0
  134. package/skills/fail_sfx.aiaudio/ref/fail.mp3 +0 -0
  135. package/skills/figer_icon.aiimage/SKILL.md +58 -0
  136. package/skills/figer_icon.aiimage/manifest.json +48 -0
  137. package/skills/figer_icon.aiimage/ref/figer.png +0 -0
  138. package/skills/figer_icon.aiimage/ref/figer.webp +0 -0
  139. package/skills/forest.aiimage/SKILL.md +74 -0
  140. package/skills/forest.aiimage/manifest.json +48 -0
  141. package/skills/fruit_tile.aiimage/SKILL.md +68 -0
  142. package/skills/fruit_tile.aiimage/manifest.json +48 -0
  143. package/skills/game_over_panel.aicomponent/SKILL.md +47 -0
  144. package/skills/game_over_panel.aicomponent/manifest.json +61 -0
  145. package/skills/game_over_panel.aicomponent/ref/GameOverPanel.ts +74 -0
  146. package/skills/game_scene.aicomponent/SKILL.md +57 -0
  147. package/skills/game_scene.aicomponent/manifest.json +36 -0
  148. package/skills/game_scene.aicomponent/ref/Game.ts +748 -0
  149. package/skills/gameplay_balance_check.aivalidator/SKILL.md +69 -0
  150. package/skills/gameplay_balance_check.aivalidator/manifest.json +21 -0
  151. package/skills/gameplay_unit_test.aivalidator/SKILL.md +89 -0
  152. package/skills/gameplay_unit_test.aivalidator/manifest.json +17 -0
  153. package/skills/gameplay_unit_test.aivalidator/ref/gameplay.test.ts +202 -0
  154. package/skills/gameplay_unit_test.aivalidator/ref/vitest.config.ts +13 -0
  155. package/skills/grid_board_layout.aicomponent/SKILL.md +85 -0
  156. package/skills/grid_board_layout.aicomponent/manifest.json +69 -0
  157. package/skills/grid_board_layout.aicomponent/ref/BoardLayout.ts +416 -0
  158. package/skills/grid_board_layout.aicomponent/ref/BoardLayout3D.ts +125 -0
  159. package/skills/grid_board_layout.aicomponent/ref/BoardLayoutMath.ts +85 -0
  160. package/skills/grid_board_layout.aicomponent/ref/BoardRenderer3D.ts +298 -0
  161. package/skills/heart_lives.aicomponent/SKILL.md +42 -0
  162. package/skills/heart_lives.aicomponent/manifest.json +25 -0
  163. package/skills/heart_lives.aicomponent/ref/HeartDisplay.ts +96 -0
  164. package/skills/idle-breathe.aicomponent/SKILL.md +27 -0
  165. package/skills/idle-breathe.aicomponent/manifest.json +20 -0
  166. package/skills/idle-breathe.aicomponent/ref/phaser.js +25 -0
  167. package/skills/idle-breathe.aicomponent/ref/playcanvas.js +29 -0
  168. package/skills/jewel_tile.aiimage/SKILL.md +63 -0
  169. package/skills/jewel_tile.aiimage/manifest.json +49 -0
  170. package/skills/knife_hit.aigameplay/SKILL.md +103 -0
  171. package/skills/knife_hit.aigameplay/manifest.json +151 -0
  172. package/skills/knife_hit.aigameplay/ref/pgs-schema.json +202 -0
  173. package/skills/knife_hit.aigameplay/ref/reducer.template.ts +196 -0
  174. package/skills/left_right_parkour.aigameplay/SKILL.md +120 -0
  175. package/skills/left_right_parkour.aigameplay/manifest.json +165 -0
  176. package/skills/left_right_parkour.aigameplay/ref/pgs-schema.json +200 -0
  177. package/skills/left_right_parkour.aigameplay/ref/reducer.template.ts +194 -0
  178. package/skills/level_data_pack.aiconfig/SKILL.md +64 -0
  179. package/skills/level_data_pack.aiconfig/manifest.json +37 -0
  180. package/skills/level_data_validator.aivalidator/SKILL.md +85 -0
  181. package/skills/level_data_validator.aivalidator/manifest.json +17 -0
  182. package/skills/level_data_validator.aivalidator/ref/LevelValidator.ts +113 -0
  183. package/skills/level_lifecycle.aicomponent/SKILL.md +81 -0
  184. package/skills/level_lifecycle.aicomponent/manifest.json +87 -0
  185. package/skills/level_lifecycle.aicomponent/ref/LevelLifecycle.ts +235 -0
  186. package/skills/level_solvability_validator.aivalidator/SKILL.md +74 -0
  187. package/skills/level_solvability_validator.aivalidator/manifest.json +23 -0
  188. package/skills/level_solvability_validator.aivalidator/ref/LevelValidator.ts +186 -0
  189. package/skills/level_state.aicomponent/SKILL.md +55 -0
  190. package/skills/level_state.aicomponent/manifest.json +34 -0
  191. package/skills/level_state.aicomponent/ref/LevelDataManager.ts +26 -0
  192. package/skills/level_state.aicomponent/ref/LevelManager.ts +26 -0
  193. package/skills/loading_screen.aicomponent/SKILL.md +57 -0
  194. package/skills/loading_screen.aicomponent/manifest.json +43 -0
  195. package/skills/loading_screen.aicomponent/ref/LoadingUI.ts +339 -0
  196. package/skills/lose_result_panel.aiimage/SKILL.md +58 -0
  197. package/skills/lose_result_panel.aiimage/manifest.json +47 -0
  198. package/skills/lose_result_panel.aiimage/ref/lose.png +0 -0
  199. package/skills/lose_result_panel.aiimage/ref/lose.webp +0 -0
  200. package/skills/lose_sfx.aiaudio/SKILL.md +59 -0
  201. package/skills/lose_sfx.aiaudio/manifest.json +45 -0
  202. package/skills/lose_sfx.aiaudio/ref/lose.mp3 +0 -0
  203. package/skills/match-pop.aicomponent/SKILL.md +29 -0
  204. package/skills/match-pop.aicomponent/manifest.json +19 -0
  205. package/skills/match-pop.aicomponent/ref/phaser.js +30 -0
  206. package/skills/match-pop.aicomponent/ref/playcanvas.js +22 -0
  207. package/skills/match3_core.aigameplay/SKILL.md +125 -0
  208. package/skills/match3_core.aigameplay/manifest.json +107 -0
  209. package/skills/match3_core.aigameplay/ref/pgs-schema.json +154 -0
  210. package/skills/match3_core.aigameplay/ref/reducer.template.ts +191 -0
  211. package/skills/match_engine.aicomponent/SKILL.md +84 -0
  212. package/skills/match_engine.aicomponent/manifest.json +23 -0
  213. package/skills/match_engine.aicomponent/ref/MatchEngine.ts +75 -0
  214. package/skills/memory_match.aigameplay/SKILL.md +111 -0
  215. package/skills/memory_match.aigameplay/manifest.json +164 -0
  216. package/skills/memory_match.aigameplay/ref/pgs-schema.json +190 -0
  217. package/skills/memory_match.aigameplay/ref/reducer.template.ts +162 -0
  218. package/skills/merge_core.aigameplay/SKILL.md +112 -0
  219. package/skills/merge_core.aigameplay/manifest.json +154 -0
  220. package/skills/merge_core.aigameplay/ref/pgs-schema.json +202 -0
  221. package/skills/merge_core.aigameplay/ref/reducer.template.ts +179 -0
  222. package/skills/mistake_sfx.aiaudio/SKILL.md +59 -0
  223. package/skills/mistake_sfx.aiaudio/manifest.json +45 -0
  224. package/skills/mistake_sfx.aiaudio/ref/mistake.mp3 +0 -0
  225. package/skills/nomove_hint_overlay.aiimage/SKILL.md +58 -0
  226. package/skills/nomove_hint_overlay.aiimage/manifest.json +48 -0
  227. package/skills/nomove_hint_overlay.aiimage/ref/nomove_hint.png +0 -0
  228. package/skills/nomove_hint_overlay.aiimage/ref/nomove_hint.webp +0 -0
  229. package/skills/normal_dot.aiimage/SKILL.md +58 -0
  230. package/skills/normal_dot.aiimage/manifest.json +46 -0
  231. package/skills/normal_dot.aiimage/ref/normal_dot.png +0 -0
  232. package/skills/normal_dot.aiimage/ref/normal_dot.webp +0 -0
  233. package/skills/ocean.aiimage/SKILL.md +71 -0
  234. package/skills/ocean.aiimage/manifest.json +49 -0
  235. package/skills/particle-confetti.aicomponent/SKILL.md +32 -0
  236. package/skills/particle-confetti.aicomponent/manifest.json +21 -0
  237. package/skills/particle-confetti.aicomponent/ref/html5-spritesheet.js +17 -0
  238. package/skills/particle-confetti.aicomponent/ref/phaser.js +38 -0
  239. package/skills/particle-explosion.aicomponent/SKILL.md +37 -0
  240. package/skills/particle-explosion.aicomponent/manifest.json +24 -0
  241. package/skills/particle-explosion.aicomponent/ref/html5-spritesheet.js +40 -0
  242. package/skills/particle-explosion.aicomponent/ref/phaser.js +46 -0
  243. package/skills/particle-explosion.aicomponent/ref/playcanvas.js +33 -0
  244. package/skills/particle-trail.aicomponent/SKILL.md +25 -0
  245. package/skills/particle-trail.aicomponent/manifest.json +22 -0
  246. package/skills/particle-trail.aicomponent/ref/phaser.js +31 -0
  247. package/skills/path_animation.aicomponent/SKILL.md +82 -0
  248. package/skills/path_animation.aicomponent/manifest.json +77 -0
  249. package/skills/path_animation.aicomponent/ref/AnimationManager.ts +694 -0
  250. package/skills/path_animation.aicomponent/ref/AnimationManager3D.ts +317 -0
  251. package/skills/path_elimination_rules.aigameplay/SKILL.md +88 -0
  252. package/skills/path_elimination_rules.aigameplay/manifest.json +119 -0
  253. package/skills/path_elimination_rules.aigameplay/ref/pgs-schema.json +227 -0
  254. package/skills/path_input_handler.aicomponent/SKILL.md +87 -0
  255. package/skills/path_input_handler.aicomponent/manifest.json +97 -0
  256. package/skills/path_input_handler.aicomponent/ref/InputHandler.ts +714 -0
  257. package/skills/path_input_handler.aicomponent/ref/InputHandler3D.ts +204 -0
  258. package/skills/path_renderer.aicomponent/SKILL.md +101 -0
  259. package/skills/path_renderer.aicomponent/manifest.json +69 -0
  260. package/skills/path_renderer.aicomponent/ref/PathRenderer.ts +509 -0
  261. package/skills/path_renderer.aicomponent/ref/PathRenderer3D.ts +176 -0
  262. package/skills/path_renderer.aicomponent/ref/PathRenderers.ts +640 -0
  263. package/skills/phaser.aicomponent/SKILL.md +315 -0
  264. package/skills/phaser.aicomponent/manifest.json +156 -0
  265. package/skills/phaser.aicomponent/ref/BootScene.ts +29 -0
  266. package/skills/phaser.aicomponent/ref/GameConfig.ts +29 -0
  267. package/skills/phaser.aicomponent/ref/GameScene.ts +88 -0
  268. package/skills/phaser.aicomponent/ref/PreloaderScene.ts +78 -0
  269. package/skills/phaser.aicomponent/ref/SceneKeys.ts +7 -0
  270. package/skills/phaser.aicomponent/ref/SoundUtils.ts +21 -0
  271. package/skills/phaser.aicomponent/ref/UiLayout.ts +74 -0
  272. package/skills/phaser.aicomponent/ref/globals.d.ts +52 -0
  273. package/skills/phaser.aicomponent/ref/index.css +40 -0
  274. package/skills/phaser.aicomponent/ref/index.html +14 -0
  275. package/skills/phaser.aicomponent/ref/index.ts +48 -0
  276. package/skills/phaser.aicomponent/ref/main.ts +16 -0
  277. package/skills/phaser.aicomponent/ref/package.json +22 -0
  278. package/skills/phaser.aicomponent/ref/tsconfig.json +25 -0
  279. package/skills/phaser.aicomponent/ref/webpack.config.js +57 -0
  280. package/skills/phaser_scene_lifecycle.aicomponent/SKILL.md +63 -0
  281. package/skills/phaser_scene_lifecycle.aicomponent/manifest.json +33 -0
  282. package/skills/pick_and_match_rules.aigameplay/SKILL.md +113 -0
  283. package/skills/pick_and_match_rules.aigameplay/manifest.json +121 -0
  284. package/skills/pick_and_match_rules.aigameplay/ref/pgs-schema.json +354 -0
  285. package/skills/pin_pull.aigameplay/SKILL.md +110 -0
  286. package/skills/pin_pull.aigameplay/manifest.json +164 -0
  287. package/skills/pin_pull.aigameplay/ref/pgs-schema.json +201 -0
  288. package/skills/pin_pull.aigameplay/ref/reducer.template.ts +216 -0
  289. package/skills/playable_app_logo.aiimage/SKILL.md +58 -0
  290. package/skills/playable_app_logo.aiimage/manifest.json +47 -0
  291. package/skills/playable_app_logo.aiimage/ref/logo.png +0 -0
  292. package/skills/playable_app_logo.aiimage/ref/logo.webp +0 -0
  293. package/skills/playable_end_screen_layout.aicomponent/SKILL.md +75 -0
  294. package/skills/playable_end_screen_layout.aicomponent/manifest.json +24 -0
  295. package/skills/playable_guidance_layer.aicomponent/SKILL.md +89 -0
  296. package/skills/playable_guidance_layer.aicomponent/manifest.json +24 -0
  297. package/skills/playable_hud_layout.aicomponent/SKILL.md +96 -0
  298. package/skills/playable_hud_layout.aicomponent/manifest.json +24 -0
  299. package/skills/playable_scripts_build.aicomponent/SKILL.md +69 -0
  300. package/skills/playable_scripts_build.aicomponent/manifest.json +53 -0
  301. package/skills/playable_scripts_build.aicomponent/ref/builds.config.js +257 -0
  302. package/skills/playcraft-3d-flip-sprite/SKILL.md +336 -0
  303. package/skills/playcraft-3d-flip-sprite/renderer/flatten_glb.mjs +62 -0
  304. package/skills/playcraft-3d-flip-sprite/renderer/render.mjs +325 -0
  305. package/skills/playcraft-3d-flip-sprite/renderer/render_single.mjs +138 -0
  306. package/skills/playcraft-asset-management/SKILL.md +73 -0
  307. package/skills/playcraft-audio-generation/SKILL.md +126 -0
  308. package/skills/playcraft-build/SKILL.md +44 -0
  309. package/skills/playcraft-code-editor/SKILL.md +71 -0
  310. package/skills/playcraft-create-remix/SKILL.md +62 -0
  311. package/skills/playcraft-deploy/SKILL.md +59 -0
  312. package/skills/playcraft-image-generation/SKILL.md +148 -0
  313. package/skills/playcraft-image-processing/SKILL.md +216 -0
  314. package/skills/playcraft-platform-intro/SKILL.md +41 -0
  315. package/skills/playcraft-prefab/SKILL.md +98 -0
  316. package/skills/playcraft-project-management/SKILL.md +57 -0
  317. package/skills/playcraft-remix-workflow/SKILL.md +119 -0
  318. package/skills/playcraft-remix-workflow/references/xplatform.schema.json5 +31 -0
  319. package/skills/playcraft-save/SKILL.md +46 -0
  320. package/skills/playcraft-skill-recommender/SKILL.md +152 -0
  321. package/skills/playcraft-sprite-generation/SKILL.md +534 -0
  322. package/skills/playcraft-sprite-remix/SKILL.md +155 -0
  323. package/skills/playcraft-sprite-sheet/SKILL.md +97 -0
  324. package/skills/playtest_report.aivalidator/SKILL.md +103 -0
  325. package/skills/playtest_report.aivalidator/manifest.json +21 -0
  326. package/skills/preloader_scene.aicomponent/SKILL.md +58 -0
  327. package/skills/preloader_scene.aicomponent/manifest.json +43 -0
  328. package/skills/preloader_scene.aicomponent/ref/Preloader.ts +339 -0
  329. package/skills/progress_bar.aicomponent/SKILL.md +38 -0
  330. package/skills/progress_bar.aicomponent/manifest.json +25 -0
  331. package/skills/progress_bar.aicomponent/ref/ProgressDisplay.ts +140 -0
  332. package/skills/references/xplatform.schema.json5 +31 -0
  333. package/skills/responsive_2d_layout.aicomponent/SKILL.md +161 -0
  334. package/skills/responsive_2d_layout.aicomponent/manifest.json +43 -0
  335. package/skills/responsive_2d_layout.aicomponent/ref/UiLayout.ts +56 -0
  336. package/skills/run_context_state.aicomponent/SKILL.md +54 -0
  337. package/skills/run_context_state.aicomponent/manifest.json +40 -0
  338. package/skills/run_context_state.aicomponent/ref/RunContextRuntime.ts +30 -0
  339. package/skills/score-fly.aicomponent/SKILL.md +31 -0
  340. package/skills/score-fly.aicomponent/manifest.json +21 -0
  341. package/skills/score-fly.aicomponent/ref/phaser.js +26 -0
  342. package/skills/score-fly.aicomponent/ref/playcanvas.js +28 -0
  343. package/skills/score_goal.aiconfig/SKILL.md +46 -0
  344. package/skills/score_goal.aiconfig/manifest.json +33 -0
  345. package/skills/screen-flash.aicomponent/SKILL.md +30 -0
  346. package/skills/screen-flash.aicomponent/manifest.json +20 -0
  347. package/skills/screen-flash.aicomponent/ref/phaser.js +48 -0
  348. package/skills/screen-shake.aicomponent/SKILL.md +30 -0
  349. package/skills/screen-shake.aicomponent/manifest.json +19 -0
  350. package/skills/screen-shake.aicomponent/ref/phaser.js +23 -0
  351. package/skills/screen-shake.aicomponent/ref/playcanvas.js +44 -0
  352. package/skills/screw_puzzle.aigameplay/SKILL.md +116 -0
  353. package/skills/screw_puzzle.aigameplay/manifest.json +164 -0
  354. package/skills/screw_puzzle.aigameplay/ref/pgs-schema.json +235 -0
  355. package/skills/screw_puzzle.aigameplay/ref/reducer.template.ts +213 -0
  356. package/skills/settings_state.aicomponent/SKILL.md +61 -0
  357. package/skills/settings_state.aicomponent/manifest.json +33 -0
  358. package/skills/settings_state.aicomponent/ref/SettingsManager.ts +130 -0
  359. package/skills/slide_out_to_tray_animation.aicomponent/SKILL.md +64 -0
  360. package/skills/slide_out_to_tray_animation.aicomponent/manifest.json +58 -0
  361. package/skills/slide_out_to_tray_animation.aicomponent/ref/AnimationManager.ts +164 -0
  362. package/skills/slide_out_to_tray_animation.aicomponent/ref/AnimationManager3D.ts +198 -0
  363. package/skills/slide_out_to_tray_animation.aicomponent/ref/BezierUtils.ts +59 -0
  364. package/skills/slot_machine.aigameplay/SKILL.md +119 -0
  365. package/skills/slot_machine.aigameplay/manifest.json +166 -0
  366. package/skills/slot_machine.aigameplay/ref/pgs-schema.json +212 -0
  367. package/skills/slot_machine.aigameplay/ref/reducer.template.ts +212 -0
  368. package/skills/sniper_shot.aigameplay/SKILL.md +84 -0
  369. package/skills/sniper_shot.aigameplay/manifest.json +153 -0
  370. package/skills/sniper_shot.aigameplay/ref/pgs-schema.json +211 -0
  371. package/skills/sniper_shot.aigameplay/ref/reducer.template.ts +211 -0
  372. package/skills/solitaire.aigameplay/SKILL.md +101 -0
  373. package/skills/solitaire.aigameplay/manifest.json +151 -0
  374. package/skills/solitaire.aigameplay/ref/pgs-schema.json +200 -0
  375. package/skills/solitaire.aigameplay/ref/reducer.template.ts +176 -0
  376. package/skills/sound-effects/SKILL.md +46 -0
  377. package/skills/sound_utils.aicomponent/SKILL.md +52 -0
  378. package/skills/sound_utils.aicomponent/manifest.json +30 -0
  379. package/skills/sound_utils.aicomponent/ref/SoundUtils.ts +29 -0
  380. package/skills/sprite-animation-2d.aicomponent/SKILL.md +45 -0
  381. package/skills/sprite-animation-2d.aicomponent/manifest.json +28 -0
  382. package/skills/sprite-animation-2d.aicomponent/ref/html5.js +83 -0
  383. package/skills/sprite-animation-2d.aicomponent/ref/phaser.js +38 -0
  384. package/skills/sprite-animation-2d.aicomponent/ref/playcanvas.js +67 -0
  385. package/skills/sprite_entity_renderer.aicomponent/SKILL.md +148 -0
  386. package/skills/sprite_entity_renderer.aicomponent/manifest.json +17 -0
  387. package/skills/sprite_entity_renderer.aicomponent/ref/SpriteEntityRenderer.ts +126 -0
  388. package/skills/success_sfx.aiaudio/SKILL.md +59 -0
  389. package/skills/success_sfx.aiaudio/manifest.json +45 -0
  390. package/skills/success_sfx.aiaudio/ref/success.mp3 +0 -0
  391. package/skills/tap_blast.aigameplay/SKILL.md +116 -0
  392. package/skills/tap_blast.aigameplay/manifest.json +153 -0
  393. package/skills/tap_blast.aigameplay/ref/pgs-schema.json +208 -0
  394. package/skills/tap_blast.aigameplay/ref/reducer.template.ts +202 -0
  395. package/skills/theme_state.aicomponent/SKILL.md +53 -0
  396. package/skills/theme_state.aicomponent/manifest.json +33 -0
  397. package/skills/theme_state.aicomponent/ref/ThemeManager.ts +174 -0
  398. package/skills/theme_switcher_build.aicomponent/SKILL.md +62 -0
  399. package/skills/theme_switcher_build.aicomponent/manifest.json +38 -0
  400. package/skills/theme_switcher_build.aicomponent/ref/theme-index.ts +8 -0
  401. package/skills/theme_variant.aiconfig/SKILL.md +78 -0
  402. package/skills/theme_variant.aiconfig/manifest.json +39 -0
  403. package/skills/theme_variant.aiconfig/ref/ExampleTheme/index.ts +16 -0
  404. package/skills/theme_variant.aiconfig/ref/ExampleTheme/levelEasy.json +141 -0
  405. package/skills/threejs.aicomponent/SKILL.md +422 -0
  406. package/skills/threejs.aicomponent/manifest.json +166 -0
  407. package/skills/threejs.aicomponent/ref/AssetLoader.ts +158 -0
  408. package/skills/threejs.aicomponent/ref/BaseScene.ts +88 -0
  409. package/skills/threejs.aicomponent/ref/GameConfig.ts +47 -0
  410. package/skills/threejs.aicomponent/ref/MainScene.ts +170 -0
  411. package/skills/threejs.aicomponent/ref/PreloaderScene.ts +93 -0
  412. package/skills/threejs.aicomponent/ref/SceneKeys.ts +6 -0
  413. package/skills/threejs.aicomponent/ref/SceneManager.ts +69 -0
  414. package/skills/threejs.aicomponent/ref/ViewportManager.ts +62 -0
  415. package/skills/threejs.aicomponent/ref/globals.d.ts +74 -0
  416. package/skills/threejs.aicomponent/ref/index.css +80 -0
  417. package/skills/threejs.aicomponent/ref/index.html +20 -0
  418. package/skills/threejs.aicomponent/ref/index.ts +117 -0
  419. package/skills/threejs.aicomponent/ref/main.ts +10 -0
  420. package/skills/threejs.aicomponent/ref/package.json +23 -0
  421. package/skills/threejs.aicomponent/ref/tsconfig.json +24 -0
  422. package/skills/threejs.aicomponent/ref/webpack.config.js +61 -0
  423. package/skills/time_clear_goal.aiconfig/SKILL.md +46 -0
  424. package/skills/time_clear_goal.aiconfig/manifest.json +32 -0
  425. package/skills/time_icon.aiimage/SKILL.md +58 -0
  426. package/skills/time_icon.aiimage/manifest.json +47 -0
  427. package/skills/time_icon.aiimage/ref/time.png +0 -0
  428. package/skills/time_icon.aiimage/ref/time.webp +0 -0
  429. package/skills/top_ui_bar.aicomponent/SKILL.md +45 -0
  430. package/skills/top_ui_bar.aicomponent/manifest.json +27 -0
  431. package/skills/top_ui_bar.aicomponent/ref/GameTopUI.ts +229 -0
  432. package/skills/tower_defence.aigameplay/SKILL.md +117 -0
  433. package/skills/tower_defence.aigameplay/manifest.json +175 -0
  434. package/skills/tower_defence.aigameplay/ref/pgs-schema.json +247 -0
  435. package/skills/tower_defence.aigameplay/ref/reducer.template.ts +239 -0
  436. package/skills/tray_container.aicomponent/SKILL.md +143 -0
  437. package/skills/tray_container.aicomponent/manifest.json +58 -0
  438. package/skills/tray_container.aicomponent/ref/TrayRenderer.ts +155 -0
  439. package/skills/tray_container.aicomponent/ref/TrayRenderer3D.ts +281 -0
  440. package/skills/tray_container.aicomponent/ref/TrayRendererHtmlOverlay.ts +228 -0
  441. package/skills/tutorial_overlay.aicomponent/SKILL.md +46 -0
  442. package/skills/tutorial_overlay.aicomponent/manifest.json +34 -0
  443. package/skills/tutorial_overlay.aicomponent/ref/TutorialManager.ts +367 -0
  444. package/skills/tween-animation-2d.aicomponent/SKILL.md +35 -0
  445. package/skills/tween-animation-2d.aicomponent/manifest.json +28 -0
  446. package/skills/tween-animation-2d.aicomponent/ref/phaser.js +49 -0
  447. package/skills/tween-animation-2d.aicomponent/ref/playcanvas.js +36 -0
  448. package/skills/typescript_module_patterns.aicomponent/SKILL.md +209 -0
  449. package/skills/typescript_module_patterns.aicomponent/manifest.json +28 -0
  450. package/skills/typescript_module_patterns.aicomponent/ref/globals.d.ts +31 -0
  451. package/skills/ui-transition.aicomponent/SKILL.md +33 -0
  452. package/skills/ui-transition.aicomponent/manifest.json +19 -0
  453. package/skills/ui-transition.aicomponent/ref/phaser.js +45 -0
  454. package/skills/ux_flow_spec.aiconfig/SKILL.md +82 -0
  455. package/skills/ux_flow_spec.aiconfig/manifest.json +39 -0
  456. package/skills/wave_difficulty.aiconfig/SKILL.md +46 -0
  457. package/skills/wave_difficulty.aiconfig/manifest.json +33 -0
  458. package/skills/webpack_build.aicomponent/SKILL.md +204 -0
  459. package/skills/webpack_build.aicomponent/manifest.json +29 -0
  460. package/skills/webpack_build.aicomponent/ref/package.json +16 -0
  461. package/skills/webpack_build.aicomponent/ref/webpack.config.js +53 -0
  462. package/skills/win_anim_sfx.aiaudio/SKILL.md +59 -0
  463. package/skills/win_anim_sfx.aiaudio/manifest.json +46 -0
  464. package/skills/win_anim_sfx.aiaudio/ref/win_anim.mp3 +0 -0
  465. package/skills/win_dot.aiimage/SKILL.md +58 -0
  466. package/skills/win_dot.aiimage/manifest.json +47 -0
  467. package/skills/win_dot.aiimage/ref/win_dot.png +0 -0
  468. package/skills/win_dot.aiimage/ref/win_dot.webp +0 -0
  469. package/skills/win_result_panel.aiimage/SKILL.md +58 -0
  470. package/skills/win_result_panel.aiimage/manifest.json +47 -0
  471. package/skills/win_result_panel.aiimage/ref/win.png +0 -0
  472. package/skills/win_result_panel.aiimage/ref/win.webp +0 -0
  473. package/skills/word_connect.aigameplay/SKILL.md +86 -0
  474. package/skills/word_connect.aigameplay/manifest.json +154 -0
  475. package/skills/word_connect.aigameplay/ref/pgs-schema.json +212 -0
  476. package/skills/word_connect.aigameplay/ref/reducer.template.ts +186 -0
  477. package/src/index.ts +10 -0
  478. package/src/skills.loader.ts +225 -0
  479. package/src/skills.types.ts +42 -0
@@ -0,0 +1,29 @@
1
+ import * as Phaser from 'phaser';
2
+
3
+ export function safePlaySound(
4
+ scene: Phaser.Scene,
5
+ key: string,
6
+ config?: Phaser.Types.Sound.SoundConfig,
7
+ ): void {
8
+ const soundManager = scene.sound;
9
+
10
+ if (!soundManager) {
11
+ return;
12
+ }
13
+
14
+ try {
15
+ const audioCache = scene.cache.audio;
16
+ const hasInCache = audioCache ? audioCache.exists(key) : false;
17
+
18
+ const existing = (soundManager as Phaser.Sound.BaseSoundManager).get(key);
19
+
20
+ if (!hasInCache && !existing) {
21
+ console.warn('[SoundUtils] Audio key not found, skip play', { key });
22
+ return;
23
+ }
24
+
25
+ soundManager.play(key, config);
26
+ } catch (e) {
27
+ console.error('[SoundUtils] Failed to play sound', { key, error: e });
28
+ }
29
+ }
@@ -0,0 +1,45 @@
1
+ # sprite-animation-2d — 2D Sprite Sheet Animation
2
+
3
+ Play a sprite sheet animation at a configurable frame rate. Works with any sprite sheet generated by `playcraft image animate` or `playcraft image sprite-sheet`.
4
+
5
+ ## Parameters
6
+
7
+ | Parameter | Type | Default | Description |
8
+ |-----------|------|---------|-------------|
9
+ | `spriteSheetPath` | string | required | Path to the sprite sheet PNG |
10
+ | `frameWidth` | number | required | Width of each individual frame |
11
+ | `frameHeight` | number | required | Height of each individual frame |
12
+ | `frameCount` | number | required | Total number of frames |
13
+ | `columns` | number | required | Frames per row in the sheet |
14
+ | `fps` | number | 12 | Playback speed in frames per second |
15
+ | `loop` | boolean | true | Whether to loop the animation |
16
+ | `startFrame` | number | 0 | First frame to start playing from |
17
+ | `pingPong` | boolean | false | Reverse direction at end instead of looping |
18
+
19
+ ## Workflow
20
+
21
+ 1. Generate a sprite sheet:
22
+ ```bash
23
+ # From static image (built-in presets):
24
+ playcraft image animate --input coin.png --preset spin --frames 8 --output coin_spin.png
25
+
26
+ # From AI-generated frames:
27
+ playcraft tools generate-image --prompt "coin sprite sheet 8 frames white background" --output coin_raw.png
28
+ playcraft image sprite-sheet --inputs frame_*.png --output coin_spin.png --columns 4
29
+ ```
30
+
31
+ 2. Load in your engine using the reference code below.
32
+
33
+ ## Engine References
34
+
35
+ - **PlayCanvas**: `ref/playcanvas.js` — uses `pc.Sprite` + `pc.AnimationComponent`
36
+ - **Phaser 3**: `ref/phaser.js` — uses `this.anims.create()` + `sprite.play()`
37
+ - **HTML5 Canvas**: `ref/html5.js` — uses `requestAnimationFrame` + `drawImage()`
38
+
39
+ ## Decision Notes
40
+
41
+ | Decision | Reason |
42
+ |----------|--------|
43
+ | Sprite sheet over individual frames | Single asset load, better memory locality, no multi-file sync issues |
44
+ | Configurable fps | Different effects need different speeds (coin spin: 12fps, idle: 6fps) |
45
+ | Columns parameter | Flexible layout, not forced to square power-of-2 sheets |
@@ -0,0 +1,28 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "atomId": "sprite-animation-2d.aicomponent",
4
+ "bundleType": "aicomponent",
5
+ "category": "animation",
6
+ "mode": "fixed",
7
+ "label": { "zh": "2D 精灵序列帧动画", "en": "2D Sprite Sheet Animation" },
8
+ "tags": ["animation", "sprite-sheet", "2d", "playcanvas", "phaser", "html5"],
9
+ "generation": {
10
+ "animationType": "sprite-sheet",
11
+ "engineSupport": ["playcanvas", "phaser", "threejs", "html5"],
12
+ "parameters": {
13
+ "frameWidth": "number — width of each frame in pixels",
14
+ "frameHeight": "number — height of each frame in pixels",
15
+ "frameCount": "number — total frames in the sheet",
16
+ "columns": "number — frames per row",
17
+ "fps": "number — playback speed (default: 12)",
18
+ "loop": "boolean — whether to loop (default: true)",
19
+ "startFrame": "number — first frame index (default: 0)"
20
+ }
21
+ },
22
+ "files": {
23
+ "skill": "SKILL.md",
24
+ "playcanvas": "ref/playcanvas.js",
25
+ "phaser": "ref/phaser.js",
26
+ "html5": "ref/html5.js"
27
+ }
28
+ }
@@ -0,0 +1,83 @@
1
+ // sprite-animation-2d — HTML5 Canvas implementation
2
+ // Works with any 2D canvas rendering context.
3
+
4
+ class SpriteAnimator {
5
+ constructor(canvas, {
6
+ imagePath,
7
+ frameWidth,
8
+ frameHeight,
9
+ frameCount,
10
+ columns,
11
+ fps = 12,
12
+ loop = true,
13
+ pingPong = false,
14
+ x = 0,
15
+ y = 0,
16
+ }) {
17
+ this.ctx = canvas.getContext('2d');
18
+ this.frameWidth = frameWidth;
19
+ this.frameHeight = frameHeight;
20
+ this.frameCount = frameCount;
21
+ this.columns = columns;
22
+ this.frameDuration = 1000 / fps;
23
+ this.loop = loop;
24
+ this.pingPong = pingPong;
25
+ this.x = x;
26
+ this.y = y;
27
+
28
+ this._frame = 0;
29
+ this._lastTime = 0;
30
+ this._direction = 1;
31
+ this._playing = false;
32
+
33
+ this.image = new Image();
34
+ this.image.onload = () => { this._playing = true; };
35
+ this.image.src = imagePath;
36
+ }
37
+
38
+ draw(timestamp) {
39
+ if (!this._playing || !this.image.complete) return;
40
+
41
+ const elapsed = timestamp - this._lastTime;
42
+ if (elapsed >= this.frameDuration) {
43
+ this._lastTime = timestamp;
44
+ this._advance();
45
+ }
46
+
47
+ const col = this._frame % this.columns;
48
+ const row = Math.floor(this._frame / this.columns);
49
+
50
+ this.ctx.drawImage(
51
+ this.image,
52
+ col * this.frameWidth,
53
+ row * this.frameHeight,
54
+ this.frameWidth,
55
+ this.frameHeight,
56
+ this.x,
57
+ this.y,
58
+ this.frameWidth,
59
+ this.frameHeight,
60
+ );
61
+ }
62
+
63
+ _advance() {
64
+ this._frame += this._direction;
65
+ if (this._frame >= this.frameCount) {
66
+ if (this.pingPong) { this._direction = -1; this._frame = this.frameCount - 2; }
67
+ else if (this.loop) { this._frame = 0; }
68
+ else { this._frame = this.frameCount - 1; this._playing = false; }
69
+ } else if (this._frame < 0) {
70
+ this._direction = 1; this._frame = 1;
71
+ }
72
+ }
73
+ }
74
+
75
+ // Usage:
76
+ // const canvas = document.getElementById('myCanvas');
77
+ // const anim = new SpriteAnimator(canvas, {
78
+ // imagePath: 'assets/coin_spin.png',
79
+ // frameWidth: 64, frameHeight: 64,
80
+ // frameCount: 8, columns: 4, fps: 12,
81
+ // });
82
+ // function loop(t) { ctx.clearRect(0, 0, canvas.width, canvas.height); anim.draw(t); requestAnimationFrame(loop); }
83
+ // requestAnimationFrame(loop);
@@ -0,0 +1,38 @@
1
+ // sprite-animation-2d — Phaser 3 implementation
2
+ // Call setupSpriteAnimation() in your Scene's create() method.
3
+
4
+ /**
5
+ * Load a sprite sheet in preload():
6
+ * this.load.spritesheet('coin', 'assets/coin_spin.png', {
7
+ * frameWidth: 64, frameHeight: 64
8
+ * });
9
+ */
10
+
11
+ function setupSpriteAnimation(scene, {
12
+ key, // texture key (same as load key)
13
+ frameCount, // total frames
14
+ fps = 12,
15
+ loop = true,
16
+ pingPong = false,
17
+ startFrame = 0,
18
+ }) {
19
+ const frames = scene.anims.generateFrameNumbers(key, {
20
+ start: startFrame,
21
+ end: frameCount - 1,
22
+ });
23
+
24
+ scene.anims.create({
25
+ key: `${key}_play`,
26
+ frames,
27
+ frameRate: fps,
28
+ repeat: loop ? -1 : 0,
29
+ yoyo: pingPong,
30
+ });
31
+
32
+ return `${key}_play`;
33
+ }
34
+
35
+ // Usage in create():
36
+ // const animKey = setupSpriteAnimation(this, { key: 'coin', frameCount: 8, fps: 12 });
37
+ // const coinSprite = this.add.sprite(400, 300, 'coin');
38
+ // coinSprite.play(animKey);
@@ -0,0 +1,67 @@
1
+ // sprite-animation-2d — PlayCanvas implementation
2
+ // Attach this script to any entity with a Sprite component.
3
+
4
+ var SpriteAnimator2D = pc.createScript('spriteAnimator2D');
5
+
6
+ SpriteAnimator2D.attributes.add('fps', { type: 'number', default: 12 });
7
+ SpriteAnimator2D.attributes.add('frameCount', { type: 'number', default: 8 });
8
+ SpriteAnimator2D.attributes.add('columns', { type: 'number', default: 4 });
9
+ SpriteAnimator2D.attributes.add('loop', { type: 'boolean', default: true });
10
+ SpriteAnimator2D.attributes.add('pingPong', { type: 'boolean', default: false });
11
+ SpriteAnimator2D.attributes.add('startFrame', { type: 'number', default: 0 });
12
+ SpriteAnimator2D.attributes.add('autoPlay', { type: 'boolean', default: true });
13
+
14
+ SpriteAnimator2D.prototype.initialize = function () {
15
+ this._frame = this.startFrame;
16
+ this._elapsed = 0;
17
+ this._playing = this.autoPlay;
18
+ this._direction = 1;
19
+ this._frameDuration = 1 / this.fps;
20
+ };
21
+
22
+ SpriteAnimator2D.prototype.update = function (dt) {
23
+ if (!this._playing) return;
24
+
25
+ this._elapsed += dt;
26
+ if (this._elapsed >= this._frameDuration) {
27
+ this._elapsed -= this._frameDuration;
28
+ this._advance();
29
+ }
30
+ };
31
+
32
+ SpriteAnimator2D.prototype._advance = function () {
33
+ this._frame += this._direction;
34
+
35
+ if (this._frame >= this.frameCount) {
36
+ if (this.pingPong) {
37
+ this._direction = -1;
38
+ this._frame = this.frameCount - 2;
39
+ } else if (this.loop) {
40
+ this._frame = 0;
41
+ } else {
42
+ this._frame = this.frameCount - 1;
43
+ this._playing = false;
44
+ }
45
+ } else if (this._frame < 0) {
46
+ if (this.pingPong) {
47
+ this._direction = 1;
48
+ this._frame = 1;
49
+ } else {
50
+ this._frame = this.frameCount - 1;
51
+ }
52
+ }
53
+
54
+ // Update sprite frame
55
+ var sprite = this.entity.sprite;
56
+ if (sprite) {
57
+ sprite.frame = this._frame;
58
+ }
59
+ };
60
+
61
+ SpriteAnimator2D.prototype.play = function () { this._playing = true; };
62
+ SpriteAnimator2D.prototype.stop = function () { this._playing = false; };
63
+ SpriteAnimator2D.prototype.reset = function () {
64
+ this._frame = this.startFrame;
65
+ this._elapsed = 0;
66
+ this._direction = 1;
67
+ };
@@ -0,0 +1,148 @@
1
+ ---
2
+ name: sprite_entity_renderer.aicomponent
3
+ description: 精灵实体渲染器。用 Phaser Image 精灵替代 Graphics API 手绘,实现更美观的棋盘实体渲染。管理精灵生命周期、方向旋转、缩放、着色和动画临时精灵。
4
+ triggers: 精灵渲染,sprite renderer,Image替代Graphics,实体渲染,旋转方向,sprite rotation,entity render
5
+ ---
6
+
7
+ # 精灵实体渲染器(Sprite Entity Renderer)
8
+
9
+ ## 说明
10
+
11
+ 当棋盘上的实体(汽车、箭头、动物等)使用 AI 生成的图片而非 Graphics API 绘制时,需要管理精灵的**创建/销毁/旋转/缩放/动画**。本 skill 提供标准化的渲染模式。
12
+
13
+ **核心思路:单图 + 旋转**
14
+ - 只需一张朝固定方向的图片
15
+ - 通过 `setRotation(angle)` 实现任意方向
16
+ - 通过 `setTint(color)` 实现颜色变化(如阻挡时变红)
17
+
18
+ ## Scaffold
19
+
20
+ | 目标路径 | 来源 | 说明 |
21
+ |---------|-----|------|
22
+ | `src/game/scenes/GameUI/SpriteEntityRenderer.ts` | `ref/SpriteEntityRenderer.ts` | 完整渲染器 |
23
+
24
+ ## Imports
25
+
26
+ - `phaser.aicomponent`(硬依赖:Phaser Image API)
27
+ - `board_entity_sprite.aiimage`(配套:图片资源来源)
28
+ - `grid_board_layout.aicomponent`(硬依赖:格子坐标)
29
+
30
+ ## 核心接口
31
+
32
+ ```typescript
33
+ class SpriteEntityRenderer {
34
+ constructor(scene: any, textureKey: string, defaultFacing: "up" | "down");
35
+
36
+ /** 渲染所有实体(销毁旧精灵 → 创建新精灵) */
37
+ renderAll(entities: EntityData[], container: Container): void;
38
+
39
+ /** 清除所有精灵 */
40
+ clear(): void;
41
+
42
+ /** 创建临时精灵(用于消除动画) */
43
+ createTempSprite(x: number, y: number, direction: string, container: Container): Image;
44
+
45
+ /** 方向→旋转角度 */
46
+ directionToAngle(direction: string): number;
47
+ }
48
+
49
+ interface EntityData {
50
+ x: number; // 格子列
51
+ y: number; // 格子行
52
+ direction: string; // "up" | "down" | "left" | "right"
53
+ tint?: number; // 可选着色
54
+ }
55
+ ```
56
+
57
+ ## Recipe
58
+
59
+ | 决策 | 原因 |
60
+ |------|------|
61
+ | **单图 + 旋转替代四方向图** | 只需维护一张图,旋转由代码处理;减少资产数量,AI 生图只需一次 |
62
+ | **精灵对象池(clear+rebuild)** | 每帧销毁旧精灵并重建,比跟踪差量更简单可靠;在 Phaser 中精灵创建开销小,试玩广告帧数要求不极端 |
63
+ | **临时精灵用于消除动画** | 消除动画时保留独立精灵放入动画容器,与主渲染层解耦;动画结束后容器销毁,无需回收到对象池 |
64
+ | **替代 Graphics 而非共存** | SpriteEntityRenderer 设计为 PathRenderer 的精灵模式替代品;两者通过同一接口协作,不共存 |
65
+
66
+ ## Adapter
67
+
68
+ - **Role**: `spriteEntityRenderer` — 棋盘实体(箭头头部)的 Phaser Image 精灵渲染器
69
+ - **Provides**: `SpriteEntityRenderer` 类(`renderAll()`、`clear()`、`createTempSprite()`、`directionToAngle()`),`EntityData` 类型
70
+ - **Requires**: `phaser.aicomponent`(Image API)、`board_entity_sprite.aiimage`(图片资源纹理 key)、`grid_board_layout.aicomponent`(格子坐标→像素坐标)
71
+ - **Consumed by**: `path_renderer.aicomponent`(精灵渲染模式时调用 `renderAll()`)、`path_animation.aicomponent`(消除动画时调用 `createTempSprite()`)
72
+ - **Integration point**: `src/game/scenes/GameUI/SpriteEntityRenderer.ts` → PathRenderer 在 sprite 模式下持有实例
73
+
74
+ ## 与 PathRenderer 的替换关系
75
+
76
+ **Before(Graphics API):**
77
+ ```typescript
78
+ // 每帧在 Graphics 对象上绘制多边形
79
+ renderGridPaths(level, progress) {
80
+ g.clear();
81
+ for (path of level.paths) {
82
+ drawSegments(g, path); // 画折线
83
+ drawArrowHead(g, path); // 画三角形
84
+ }
85
+ }
86
+ ```
87
+
88
+ **After(Sprite Renderer):**
89
+ ```typescript
90
+ // 管理精灵对象池
91
+ renderGridPaths(level, progress) {
92
+ this.spriteRenderer.clear();
93
+ const entities = level.paths
94
+ .filter(notRemoved)
95
+ .map(p => ({ x: p.head.x, y: p.head.y, direction: p.direction }));
96
+ this.spriteRenderer.renderAll(entities, boardContainer);
97
+ }
98
+ ```
99
+
100
+ ## 方向映射规则
101
+
102
+ ```typescript
103
+ // 构造函数指定图片默认朝向
104
+ const renderer = new SpriteEntityRenderer(scene, "car", "down");
105
+
106
+ // 内部映射逻辑:
107
+ // 若 defaultFacing = "down":
108
+ // down → 0 (不旋转)
109
+ // up → π (180°)
110
+ // left → π/2 (90° 顺时针)
111
+ // right → -π/2 (-90°)
112
+ //
113
+ // 若 defaultFacing = "up":
114
+ // up → 0
115
+ // down → π
116
+ // right → π/2
117
+ // left → -π/2
118
+ ```
119
+
120
+ ## 动画集成
121
+
122
+ 消除动画时创建临时精灵放入容器:
123
+
124
+ ```typescript
125
+ // 在 AnimationManager 中
126
+ const car = spriteRenderer.createTempSprite(hx, hy, path.direction, container);
127
+
128
+ scene.tweens.add({
129
+ targets: container,
130
+ x: dx * slideDistance,
131
+ y: dy * slideDistance,
132
+ alpha: 0,
133
+ duration: 400,
134
+ onComplete: () => container.destroy(), // 精灵随容器销毁
135
+ });
136
+ ```
137
+
138
+ ## Skill Definition
139
+
140
+ ```yaml
141
+ tools:
142
+ - read_file
143
+ - write_file
144
+ inputs:
145
+ - source: ref/SpriteEntityRenderer.ts
146
+ outputs:
147
+ - renderer: SpriteEntityRenderer class
148
+ ```
@@ -0,0 +1,17 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "atomId": "sprite_entity_renderer.aicomponent",
4
+ "bundleType": "aicomponent",
5
+ "category": "rendering",
6
+ "mode": "fixed",
7
+ "label": {
8
+ "zh": "精灵实体渲染器(替代 Graphics 绘制)",
9
+ "en": "Sprite entity renderer (replaces Graphics drawing)"
10
+ },
11
+ "tags": ["sprite", "renderer", "image", "rotation", "entity", "phaser"],
12
+ "bindingRoles": ["entityRenderer"],
13
+ "files": {
14
+ "skill": "SKILL.md",
15
+ "ref": ["ref/SpriteEntityRenderer.ts"]
16
+ }
17
+ }
@@ -0,0 +1,126 @@
1
+ import * as Phaser from "phaser";
2
+
3
+ export interface EntityData {
4
+ x: number;
5
+ y: number;
6
+ direction: string;
7
+ tint?: number;
8
+ }
9
+
10
+ /**
11
+ * 精灵实体渲染器
12
+ * 用 Phaser Image 精灵替代 Graphics API 手绘
13
+ */
14
+ export class SpriteEntityRenderer {
15
+ private scene: any;
16
+ private textureKey: string;
17
+ private defaultFacing: "up" | "down";
18
+ private sprites: Phaser.GameObjects.Image[] = [];
19
+
20
+ /**
21
+ * @param scene - Phaser 场景引用
22
+ * @param textureKey - 精灵纹理 key(在 Preloader 中加载的 key)
23
+ * @param defaultFacing - 图片默认朝向("up" 或 "down")
24
+ */
25
+ constructor(scene: any, textureKey: string, defaultFacing: "up" | "down" = "down") {
26
+ this.scene = scene;
27
+ this.textureKey = textureKey;
28
+ this.defaultFacing = defaultFacing;
29
+ }
30
+
31
+ /**
32
+ * 渲染所有实体(先清除旧精灵,再创建新精灵)
33
+ */
34
+ renderAll(entities: EntityData[], container: Phaser.GameObjects.Container): void {
35
+ this.clear();
36
+
37
+ for (const entity of entities) {
38
+ const { x: cx, y: cy } = this.cellCenter(entity.x, entity.y);
39
+ const angle = this.directionToAngle(entity.direction);
40
+ const targetSize = this.scene.cellSize * 0.8;
41
+
42
+ const sprite = this.scene.add.image(cx, cy, this.textureKey) as Phaser.GameObjects.Image;
43
+ sprite.setOrigin(0.5);
44
+ sprite.setRotation(angle);
45
+
46
+ const scale = Math.min(targetSize / sprite.width, targetSize / sprite.height);
47
+ sprite.setScale(scale);
48
+
49
+ if (entity.tint !== undefined) {
50
+ sprite.setTint(entity.tint);
51
+ }
52
+
53
+ container.add(sprite);
54
+ this.sprites.push(sprite);
55
+ }
56
+ }
57
+
58
+ /**
59
+ * 清除所有管理的精灵
60
+ */
61
+ clear(): void {
62
+ for (const sprite of this.sprites) {
63
+ sprite.destroy();
64
+ }
65
+ this.sprites = [];
66
+ }
67
+
68
+ /**
69
+ * 创建临时精灵(用于消除动画)
70
+ * 调用方负责销毁(通常通过销毁容器)
71
+ */
72
+ createTempSprite(
73
+ x: number,
74
+ y: number,
75
+ direction: string,
76
+ container: Phaser.GameObjects.Container,
77
+ ): Phaser.GameObjects.Image {
78
+ const angle = this.directionToAngle(direction);
79
+ const targetSize = this.scene.cellSize * 0.8;
80
+
81
+ const sprite = this.scene.add.image(x, y, this.textureKey) as Phaser.GameObjects.Image;
82
+ sprite.setOrigin(0.5);
83
+ sprite.setRotation(angle);
84
+
85
+ const scale = Math.min(targetSize / sprite.width, targetSize / sprite.height);
86
+ sprite.setScale(scale);
87
+
88
+ container.add(sprite);
89
+ return sprite;
90
+ }
91
+
92
+ /**
93
+ * 方向转旋转角度
94
+ * 根据图片默认朝向计算旋转值
95
+ */
96
+ directionToAngle(direction: string): number {
97
+ if (this.defaultFacing === "down") {
98
+ switch (direction) {
99
+ case "down": return 0;
100
+ case "up": return Math.PI;
101
+ case "left": return Math.PI / 2;
102
+ case "right": return -Math.PI / 2;
103
+ default: return 0;
104
+ }
105
+ } else {
106
+ // defaultFacing === "up"
107
+ switch (direction) {
108
+ case "up": return 0;
109
+ case "down": return Math.PI;
110
+ case "right": return Math.PI / 2;
111
+ case "left": return -Math.PI / 2;
112
+ default: return 0;
113
+ }
114
+ }
115
+ }
116
+
117
+ /**
118
+ * 计算格子中心坐标
119
+ */
120
+ private cellCenter(col: number, row: number): { x: number; y: number } {
121
+ return {
122
+ x: col * this.scene.cellWidth + this.scene.cellWidth / 2,
123
+ y: row * this.scene.cellHeight + this.scene.cellHeight / 2,
124
+ };
125
+ }
126
+ }
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: success_sfx.aiaudio
3
+ description: 所有路径消除,关卡通关时的短促胜利音效。
4
+ triggers: 需要生成关卡通关胜利音效时触发。
5
+ ---
6
+
7
+ # 关卡通关音效
8
+
9
+ ## Recipe
10
+
11
+ 生成提示词见 manifest.json generation.prompt。
12
+ - model: Google Lyria 3(平台默认,见 manifest.json generation.platformSkill)
13
+ - format: mp3
14
+ - loop: false
15
+
16
+ ## Result
17
+
18
+ - 产物文件:`success.mp3`
19
+ - 在 Preloader.ts 中作为 `sfxSuccess` key 加载
20
+
21
+ ## Binding
22
+
23
+ ```json
24
+ {
25
+ "role": "sfxSuccess",
26
+ "target": "assets/sounds/success.mp3",
27
+ "type": "audio-asset-reference"
28
+ }
29
+ ```
30
+
31
+ ## 生成方式
32
+
33
+ Platform Skill: `playcraft-audio-generation`
34
+
35
+ ```bash
36
+ # 1. 生成 SFX(--prompt 必须英文)
37
+ playcraft tools generate-sfx \
38
+ --prompt "triumphant success jingle for completing a puzzle level, short and satisfying" \
39
+ --duration 2 \
40
+ --output ta-workspace/raw_sfx.mp3
41
+
42
+ # 2. 归一化音量
43
+ playcraft audio normalize --input ta-workspace/raw_sfx.mp3 --output ta-workspace/raw_sfx.mp3 --target-loudness -16
44
+
45
+ # 3. 压缩(SFX 目标 ≤15KB)
46
+ playcraft audio compress --input ta-workspace/raw_sfx.mp3 --output ta-workspace/success.mp3 --target-size 15KB
47
+
48
+ # 4. 将产物写入 sandbox 对应路径(见 binding.target)
49
+ ```
50
+ ## Skill Definition
51
+
52
+ ```yaml
53
+ tools:
54
+ - generate_audio
55
+ inputs:
56
+ - prompt: see manifest.json
57
+ outputs:
58
+ - audio: success.mp3
59
+ ```
@@ -0,0 +1,45 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "atomId": "success_sfx.aiaudio",
4
+ "bundleType": "aiaudio",
5
+ "category": "audio",
6
+ "mode": "generative",
7
+ "label": {
8
+ "zh": "关卡通关音效",
9
+ "en": "Level success SFX"
10
+ },
11
+ "tags": [
12
+ "audio",
13
+ "sfx",
14
+ "success",
15
+ "win",
16
+ "level-complete"
17
+ ],
18
+ "bindingRoles": [
19
+ "sfxSuccess"
20
+ ],
21
+ "generation": {
22
+ "kind": "sfx",
23
+ "prompt": "triumphant success jingle for completing a puzzle level, short and satisfying",
24
+ "duration": 2,
25
+ "loop": false,
26
+ "referenceAudio": "ref/success.mp3",
27
+ "platformSkill": "playcraft-audio-generation"
28
+ },
29
+ "result": {
30
+ "outputFile": "ref/success.mp3",
31
+ "format": "mp3",
32
+ "constraints": {
33
+ "maxDuration": 2
34
+ }
35
+ },
36
+ "binding": {
37
+ "role": "sfxSuccess",
38
+ "target": "assets/sounds/success.mp3",
39
+ "type": "audio-asset-reference"
40
+ },
41
+ "files": {
42
+ "skill": "SKILL.md",
43
+ "asset": "ref/success.mp3"
44
+ }
45
+ }