@pix3/cli 1.6.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 (155) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +754 -0
  3. package/dist/index.js +494 -0
  4. package/dist/runtime-types.json +1 -0
  5. package/dist/smoke/prebuilt/build-7MIXIMSZ.mjs +948 -0
  6. package/dist/smoke/prebuilt/chunk-J2SJVMDO.mjs +2 -0
  7. package/dist/smoke/prebuilt/chunk-OJXQXIIQ.mjs +239 -0
  8. package/dist/smoke/prebuilt/chunk-P2CBRXPJ.mjs +4050 -0
  9. package/dist/smoke/prebuilt/runtime.mjs +2 -0
  10. package/dist/smoke/prebuilt/smoke-worker.mjs +3 -0
  11. package/dist/smoke/prebuilt/three.mjs +2 -0
  12. package/dist/smoke/prebuilt/tree-defaults.mjs +2 -0
  13. package/dist/validate/prebuilt/build-AUGKXER3.js +948 -0
  14. package/dist/validate/prebuilt/bundle-main.js +24 -0
  15. package/dist/validate/prebuilt/chunk-6ACT6FNV.js +4050 -0
  16. package/dist/validate/prebuilt/chunk-BS2OZM7U.js +239 -0
  17. package/dist/validate/prebuilt/runtime.js +2 -0
  18. package/dist/validate/prebuilt/three.js +2 -0
  19. package/kit/files/.claude/skills/pix3-nodes/SKILL.md +210 -0
  20. package/kit/files/.claude/skills/pix3-nodes/reference.md +1331 -0
  21. package/kit/files/.claude/skills/pix3-scene-format/SKILL.md +235 -0
  22. package/kit/files/.claude/skills/pix3-scene-format/reference.md +176 -0
  23. package/kit/files/.claude/skills/pix3-scripts/SKILL.md +281 -0
  24. package/kit/files/.claude/skills/pix3-scripts/reference.md +638 -0
  25. package/kit/files/.claude/skills/pix3-verify/SKILL.md +386 -0
  26. package/kit/files/.claude/skills/pix3-verify/reference.md +21 -0
  27. package/kit/files/AGENTS.md +203 -0
  28. package/kit/files/CLAUDE.md +1 -0
  29. package/kit/kit.json +24 -0
  30. package/package.json +54 -0
  31. package/templates/empty-2d/files/README.md +20 -0
  32. package/templates/empty-2d/files/scenes/main.pix3scene +68 -0
  33. package/templates/empty-2d/files/sprites/pix3-logo.png +0 -0
  34. package/templates/empty-2d/template.yaml +7 -0
  35. package/templates/empty-3d/files/README.md +20 -0
  36. package/templates/empty-3d/files/scenes/main.pix3scene +108 -0
  37. package/templates/empty-3d/files/sprites/pix3-logo.png +0 -0
  38. package/templates/empty-3d/template.yaml +7 -0
  39. package/templates/idea-blank/files/README.md +22 -0
  40. package/templates/idea-blank/files/scenes/main.pix3scene +37 -0
  41. package/templates/idea-blank/template.yaml +10 -0
  42. package/templates/minigame-2d/files/README.md +44 -0
  43. package/templates/minigame-2d/files/design/tests/reachability.json +1 -0
  44. package/templates/minigame-2d/files/design/tests/routines/mute-music.json +44 -0
  45. package/templates/minigame-2d/files/scenes/main.pix3scene +84 -0
  46. package/templates/minigame-2d/files/scenes/menu.pix3scene +118 -0
  47. package/templates/minigame-2d/files/scenes/ui/settings-window.pix3scene +138 -0
  48. package/templates/minigame-2d/files/scripts/GameFlow.ts +133 -0
  49. package/templates/minigame-2d/files/scripts/MenuFlow.ts +217 -0
  50. package/templates/minigame-2d/files/scripts/SettingsWindow.ts +198 -0
  51. package/templates/minigame-2d/template.yaml +10 -0
  52. package/templates/playable-2d/files/README.md +30 -0
  53. package/templates/playable-2d/files/design/recipe.md +83 -0
  54. package/templates/playable-2d/files/design/tests/reachability.json +4 -0
  55. package/templates/playable-2d/files/design/tests/routines/intro-to-cta.json +32 -0
  56. package/templates/playable-2d/files/scenes/main.pix3scene +111 -0
  57. package/templates/playable-2d/files/scenes/ui/end-screen.pix3scene +91 -0
  58. package/templates/playable-2d/files/scenes/ui/intro.pix3scene +65 -0
  59. package/templates/playable-2d/files/scripts/CtaButton.ts +55 -0
  60. package/templates/playable-2d/files/scripts/GameFlow.ts +256 -0
  61. package/templates/playable-2d/files/sprites/pix3-logo.png +0 -0
  62. package/templates/playable-2d/template.yaml +9 -0
  63. package/templates/playable-3d/files/README.md +32 -0
  64. package/templates/playable-3d/files/design/recipe.md +127 -0
  65. package/templates/playable-3d/files/design/tests/reachability.json +4 -0
  66. package/templates/playable-3d/files/design/tests/routines/intro-to-cta.json +32 -0
  67. package/templates/playable-3d/files/scenes/main.pix3scene +230 -0
  68. package/templates/playable-3d/files/scenes/ui/end-screen.pix3scene +91 -0
  69. package/templates/playable-3d/files/scenes/ui/intro.pix3scene +65 -0
  70. package/templates/playable-3d/files/scripts/CtaButton.ts +55 -0
  71. package/templates/playable-3d/files/scripts/GameFlow.ts +309 -0
  72. package/templates/playable-3d/files/scripts/GameRules.ts +290 -0
  73. package/templates/playable-3d/files/scripts/ScoreHud.ts +113 -0
  74. package/templates/playable-3d/template.yaml +9 -0
  75. package/templates/recipe-arena-2d/files/README.md +48 -0
  76. package/templates/recipe-arena-2d/files/design/recipe.md +127 -0
  77. package/templates/recipe-arena-2d/files/design/tests/reachability.json +4 -0
  78. package/templates/recipe-arena-2d/files/design/tests/routines/terminal-retry.json +23 -0
  79. package/templates/recipe-arena-2d/files/scenes/main.pix3scene +292 -0
  80. package/templates/recipe-arena-2d/files/scenes/menu.pix3scene +100 -0
  81. package/templates/recipe-arena-2d/files/scenes/prefabs/hazard.pix3scene +42 -0
  82. package/templates/recipe-arena-2d/files/scenes/prefabs/pickup.pix3scene +45 -0
  83. package/templates/recipe-arena-2d/files/scenes/ui/result.pix3scene +85 -0
  84. package/templates/recipe-arena-2d/files/scripts/GameRules.ts +368 -0
  85. package/templates/recipe-arena-2d/files/scripts/MenuFlow.ts +106 -0
  86. package/templates/recipe-arena-2d/files/scripts/PlayerController.ts +151 -0
  87. package/templates/recipe-arena-2d/files/scripts/ScoreHud.ts +94 -0
  88. package/templates/recipe-arena-2d/files/scripts/Spawner.ts +214 -0
  89. package/templates/recipe-arena-2d/files/scripts/TouchRules.ts +174 -0
  90. package/templates/recipe-arena-2d/files/sprites/ph-avatar.png +0 -0
  91. package/templates/recipe-arena-2d/files/sprites/ph-hazard.png +0 -0
  92. package/templates/recipe-arena-2d/files/sprites/ph-pickup.png +0 -0
  93. package/templates/recipe-arena-2d/template.yaml +10 -0
  94. package/templates/recipe-blank-2d/files/README.md +61 -0
  95. package/templates/recipe-blank-2d/files/design/recipe.md +148 -0
  96. package/templates/recipe-blank-2d/files/design/tests/reachability.json +4 -0
  97. package/templates/recipe-blank-2d/files/design/tests/routines/restart.json +27 -0
  98. package/templates/recipe-blank-2d/files/design/tests/routines/terminal-retry.json +23 -0
  99. package/templates/recipe-blank-2d/files/scenes/main.pix3scene +224 -0
  100. package/templates/recipe-blank-2d/files/scenes/ui/result.pix3scene +85 -0
  101. package/templates/recipe-blank-2d/files/scripts/GameRules.ts +350 -0
  102. package/templates/recipe-blank-2d/files/scripts/ScoreHud.ts +110 -0
  103. package/templates/recipe-blank-2d/files/sprites/ph-bg.png +0 -0
  104. package/templates/recipe-blank-2d/files/sprites/ph-capsule.png +0 -0
  105. package/templates/recipe-blank-2d/files/sprites/ph-circle.png +0 -0
  106. package/templates/recipe-blank-2d/files/sprites/ph-orb.png +0 -0
  107. package/templates/recipe-blank-2d/files/sprites/ph-ring.png +0 -0
  108. package/templates/recipe-blank-2d/files/sprites/ph-star.png +0 -0
  109. package/templates/recipe-blank-2d/template.yaml +10 -0
  110. package/templates/recipe-bouncer-2d/files/README.md +81 -0
  111. package/templates/recipe-bouncer-2d/files/design/recipe.md +146 -0
  112. package/templates/recipe-bouncer-2d/files/design/tests/reachability.json +4 -0
  113. package/templates/recipe-bouncer-2d/files/design/tests/routines/terminal-retry.json +23 -0
  114. package/templates/recipe-bouncer-2d/files/scenes/main.pix3scene +615 -0
  115. package/templates/recipe-bouncer-2d/files/scenes/menu.pix3scene +191 -0
  116. package/templates/recipe-bouncer-2d/files/scenes/ui/result.pix3scene +87 -0
  117. package/templates/recipe-bouncer-2d/files/scripts/BallBody.ts +298 -0
  118. package/templates/recipe-bouncer-2d/files/scripts/GameRules.ts +377 -0
  119. package/templates/recipe-bouncer-2d/files/scripts/MenuFlow.ts +109 -0
  120. package/templates/recipe-bouncer-2d/files/scripts/PaddleController.ts +112 -0
  121. package/templates/recipe-bouncer-2d/files/scripts/ScoreHud.ts +94 -0
  122. package/templates/recipe-bouncer-2d/files/scripts/TouchRules.ts +263 -0
  123. package/templates/recipe-bouncer-2d/files/scripts/ball-collision.ts +307 -0
  124. package/templates/recipe-bouncer-2d/files/sprites/ph-ball.png +0 -0
  125. package/templates/recipe-bouncer-2d/files/sprites/ph-bg.png +0 -0
  126. package/templates/recipe-bouncer-2d/files/sprites/ph-bumper.png +0 -0
  127. package/templates/recipe-bouncer-2d/files/sprites/ph-paddle.png +0 -0
  128. package/templates/recipe-bouncer-2d/template.yaml +10 -0
  129. package/templates/recipe-grid-3d/files/README.md +22 -0
  130. package/templates/recipe-grid-3d/files/design/recipe.md +110 -0
  131. package/templates/recipe-grid-3d/files/scenes/main.pix3scene +169 -0
  132. package/templates/recipe-grid-3d/files/scenes/menu.pix3scene +100 -0
  133. package/templates/recipe-grid-3d/files/scenes/ui/result.pix3scene +105 -0
  134. package/templates/recipe-grid-3d/files/scripts/GridBoard.ts +319 -0
  135. package/templates/recipe-grid-3d/files/scripts/GridRules.ts +278 -0
  136. package/templates/recipe-grid-3d/files/scripts/MenuFlow.ts +106 -0
  137. package/templates/recipe-grid-3d/files/scripts/ScoreHud.ts +94 -0
  138. package/templates/recipe-grid-3d/template.yaml +10 -0
  139. package/templates/recipe-tapper-2d/files/README.md +39 -0
  140. package/templates/recipe-tapper-2d/files/design/recipe.md +132 -0
  141. package/templates/recipe-tapper-2d/files/design/tests/reachability.json +4 -0
  142. package/templates/recipe-tapper-2d/files/design/tests/routines/terminal-retry.json +23 -0
  143. package/templates/recipe-tapper-2d/files/scenes/main.pix3scene +269 -0
  144. package/templates/recipe-tapper-2d/files/scenes/menu.pix3scene +100 -0
  145. package/templates/recipe-tapper-2d/files/scenes/prefabs/hazard.pix3scene +42 -0
  146. package/templates/recipe-tapper-2d/files/scenes/prefabs/target.pix3scene +45 -0
  147. package/templates/recipe-tapper-2d/files/scenes/ui/result.pix3scene +85 -0
  148. package/templates/recipe-tapper-2d/files/scripts/GameRules.ts +368 -0
  149. package/templates/recipe-tapper-2d/files/scripts/MenuFlow.ts +106 -0
  150. package/templates/recipe-tapper-2d/files/scripts/ScoreHud.ts +94 -0
  151. package/templates/recipe-tapper-2d/files/scripts/Spawner.ts +214 -0
  152. package/templates/recipe-tapper-2d/files/scripts/TouchRules.ts +192 -0
  153. package/templates/recipe-tapper-2d/files/sprites/ph-hazard.png +0 -0
  154. package/templates/recipe-tapper-2d/files/sprites/ph-target.png +0 -0
  155. package/templates/recipe-tapper-2d/template.yaml +10 -0
@@ -0,0 +1,230 @@
1
+ # Pix3 Scene File (YAML)
2
+ # Playable 3D blank (portrait 1080x1920): 3D gameplay placeholder plus a 2D UI
3
+ # layer with a tap-to-start intro overlay, a score/lives/time HUD, and an end
4
+ # screen with a CTA button. `hud-root` carries all three components: GameFlow
5
+ # (phases), GameRules (score/lives/win-lose) and ScoreHud (display only).
6
+ #
7
+ # Full-screen UI lives in its own file under scenes/ui/ and is instanced into
8
+ # `hud-root` hidden (`visible: false` = editor only; `initiallyVisible` in the
9
+ # overlay file is what play mode reads), so opening this scene shows the stage
10
+ # rather than a dim or a CTA card:
11
+ # intro-overlay (intro-dim, intro-label) scenes/ui/intro.pix3scene
12
+ # end-screen (end-dim, end-label, cta-button) scenes/ui/end-screen.pix3scene
13
+ # Instance children keep their ids, so `GameFlow`'s introNode/endNode,
14
+ # `GameRules`' resultLabel and every `findNode` still resolve.
15
+ version: 1.0.0
16
+ metadata:
17
+ author: Pix3 Template
18
+ description: Playable 3D blank with intro overlay and CTA end screen
19
+ root:
20
+ - id: game-root
21
+ type: Node3D
22
+ name: Game Root
23
+ properties:
24
+ transform:
25
+ position: [0, 0, 0]
26
+ rotationEuler: [0, 0, 0]
27
+ scale: [1, 1, 1]
28
+ children:
29
+ - id: main-camera
30
+ type: Camera3D
31
+ name: Main Camera
32
+ properties:
33
+ projection: perspective
34
+ fov: 60
35
+ near: 0.1
36
+ far: 1000
37
+ transform:
38
+ position: [0, 3, 8]
39
+ rotationEuler: [-15, 0, 0]
40
+ scale: [1, 1, 1]
41
+ children: []
42
+ - id: key-light
43
+ type: DirectionalLightNode
44
+ name: Key Light
45
+ properties:
46
+ intensity: 1.2
47
+ color: "#ffffff"
48
+ transform:
49
+ position: [5, 8, 3]
50
+ rotationEuler: [-45, 35, 0]
51
+ scale: [1, 1, 1]
52
+ children: []
53
+ - id: ambient-light
54
+ type: AmbientLightNode
55
+ name: Ambient Light
56
+ properties:
57
+ intensity: 0.5
58
+ color: "#ffffff"
59
+ transform:
60
+ position: [0, 0, 0]
61
+ rotationEuler: [0, 0, 0]
62
+ scale: [1, 1, 1]
63
+ children: []
64
+ - id: ground
65
+ type: GeometryMesh
66
+ name: Ground
67
+ properties:
68
+ geometry: box
69
+ size: [12, 0.2, 12]
70
+ material:
71
+ type: lambert
72
+ color: "#2a2a3e"
73
+ transform:
74
+ position: [0, -0.1, 0]
75
+ rotationEuler: [0, 0, 0]
76
+ scale: [1, 1, 1]
77
+ children: []
78
+ - id: hero-box
79
+ type: GeometryMesh
80
+ name: Hero Box
81
+ properties:
82
+ geometry: box
83
+ size: [1, 1, 1]
84
+ material:
85
+ type: lambert
86
+ color: "#ffcf33"
87
+ transform:
88
+ position: [0, 0.5, 0]
89
+ rotationEuler: [0, 45, 0]
90
+ scale: [1, 1, 1]
91
+ components:
92
+ - id: hero-rotate
93
+ type: core:Rotate
94
+ enabled: true
95
+ config: {}
96
+ children: []
97
+
98
+ - id: hud-root
99
+ type: Group2D
100
+ name: HUD Root
101
+ properties:
102
+ width: 1080
103
+ height: 1920
104
+ layout:
105
+ enabled: true
106
+ horizontalAlign: stretch
107
+ verticalAlign: stretch
108
+ components:
109
+ - id: game-flow
110
+ type: user:GameFlow
111
+ enabled: true
112
+ config:
113
+ introNode: intro-overlay
114
+ endNode: end-screen
115
+ autoWinAfterSec: 15
116
+ skipIntro: false
117
+ - id: game-rules
118
+ type: user:GameRules
119
+ enabled: true
120
+ config:
121
+ winMode: score
122
+ targetScore: 10
123
+ timeLimitSec: 0
124
+ startingLives: 3
125
+ resultLabel: end-label
126
+ winText: "YOU WIN!"
127
+ loseText: "GAME OVER"
128
+ # The run starts when GameFlow leaves the tap gate, not when the scene loads.
129
+ startWithFlow: true
130
+ - id: score-hud
131
+ type: user:ScoreHud
132
+ enabled: true
133
+ config:
134
+ sourceNode: hud-root
135
+ scoreLabel: score-label
136
+ scoreFormat: "SCORE {value}"
137
+ timeLabel: time-label
138
+ timeFormat: "{value}"
139
+ livesBar: lives-bar
140
+ children:
141
+ - id: hud-label
142
+ type: Label2D
143
+ name: HUD Label
144
+ properties:
145
+ label: "PROTOTYPE"
146
+ labelFontSize: 40
147
+ labelColor: "#ffffff"
148
+ labelAlign: center
149
+ transform:
150
+ position: [0, 780]
151
+ scale: [1, 1]
152
+ rotation: 0
153
+ layout:
154
+ enabled: true
155
+ horizontalAlign: center
156
+ verticalAlign: top
157
+ children: []
158
+ - id: score-label
159
+ type: Label2D
160
+ name: Score Label
161
+ properties:
162
+ label: "SCORE 0"
163
+ labelFontSize: 44
164
+ labelColor: "#ffffff"
165
+ labelAlign: left
166
+ transform:
167
+ position: [-340, 880]
168
+ scale: [1, 1]
169
+ rotation: 0
170
+ layout:
171
+ enabled: true
172
+ horizontalAlign: left
173
+ verticalAlign: top
174
+ children: []
175
+ - id: time-label
176
+ type: Label2D
177
+ name: Time Label
178
+ properties:
179
+ label: "0"
180
+ labelFontSize: 44
181
+ labelColor: "#f5ae39"
182
+ labelAlign: center
183
+ transform:
184
+ position: [0, 880]
185
+ scale: [1, 1]
186
+ rotation: 0
187
+ layout:
188
+ enabled: true
189
+ horizontalAlign: center
190
+ verticalAlign: top
191
+ children: []
192
+ - id: lives-bar
193
+ type: Bar2D
194
+ name: Lives Bar
195
+ properties:
196
+ width: 240
197
+ height: 28
198
+ minValue: 0
199
+ maxValue: 3
200
+ value: 3
201
+ barColor: "#ff4d6d"
202
+ backBackgroundColor: "#2a3352"
203
+ showBorder: false
204
+ transform:
205
+ position: [340, 885]
206
+ scale: [1, 1]
207
+ rotation: 0
208
+ layout:
209
+ enabled: true
210
+ horizontalAlign: right
211
+ verticalAlign: top
212
+ children: []
213
+ # Tap gate — authored in scenes/ui/intro.pix3scene so this scene opens on
214
+ # the GAME. `visible: false` hides it in the EDITOR only; `initiallyVisible`
215
+ # (in the overlay file) is what play mode reads. Tick the eye to preview it
216
+ # composited over the stage.
217
+ - id: intro-overlay
218
+ name: Intro Overlay
219
+ instance: res://scenes/ui/intro.pix3scene
220
+ properties:
221
+ visible: false
222
+ # End screen — authored in scenes/ui/end-screen.pix3scene so this scene opens
223
+ # on the GAME. `visible: false` hides it in the EDITOR only; `initiallyVisible`
224
+ # (in the overlay file) is what play mode reads. Tick the eye to preview it
225
+ # composited over the stage.
226
+ - id: end-screen
227
+ name: End Screen
228
+ instance: res://scenes/ui/end-screen.pix3scene
229
+ properties:
230
+ visible: false
@@ -0,0 +1,91 @@
1
+ # Pix3 Scene File (YAML)
2
+ # Playable 3D — the END screen (result + CTA), in its own file so the game
3
+ # scene opens clean. `main.pix3scene` carries it as a one-line `instance:`
4
+ # reference marked `visible: false`, which hides it in the EDITOR only;
5
+ # `initiallyVisible: false` below is what play mode reads, and `user:GameFlow`
6
+ # reveals it on `finish()`.
7
+ #
8
+ # Edit it here, full-screen, in its own tab. To preview it composited over the
9
+ # game, tick the eye on `end-screen` in main.pix3scene — just do not commit
10
+ # that tick, or every iteration starts behind a CTA card again.
11
+ #
12
+ # Stable node ids (design/recipe.md is the contract — do not rename these):
13
+ # end-screen, end-dim, end-label, cta-button
14
+ version: 1.0.0
15
+ metadata:
16
+ author: Pix3 Template
17
+ description: End screen — dim, result headline and a PLAY NOW CTA button
18
+ root:
19
+ - id: end-screen
20
+ type: Group2D
21
+ name: End Screen
22
+ properties:
23
+ width: 1080
24
+ height: 1920
25
+ initiallyVisible: false
26
+ layout:
27
+ enabled: true
28
+ horizontalAlign: stretch
29
+ verticalAlign: stretch
30
+ children:
31
+ - id: end-dim
32
+ type: ColorRect2D
33
+ name: End Dim
34
+ properties:
35
+ width: 1080
36
+ height: 1920
37
+ color: "#000000"
38
+ opacity: 0.75
39
+ transform:
40
+ position: [0, 0]
41
+ scale: [1, 1]
42
+ rotation: 0
43
+ layout:
44
+ enabled: true
45
+ horizontalAlign: stretch
46
+ verticalAlign: stretch
47
+ children: []
48
+ - id: end-label
49
+ type: Label2D
50
+ name: End Label
51
+ properties:
52
+ label: "GREAT RUN!"
53
+ labelFontSize: 84
54
+ labelColor: "#ffcf33"
55
+ labelAlign: center
56
+ transform:
57
+ position: [0, 220]
58
+ scale: [1, 1]
59
+ rotation: 0
60
+ layout:
61
+ enabled: true
62
+ horizontalAlign: center
63
+ verticalAlign: center
64
+ children: []
65
+ - id: cta-button
66
+ type: Button2D
67
+ name: CTA Button
68
+ properties:
69
+ width: 480
70
+ height: 140
71
+ label: "PLAY NOW"
72
+ labelFontSize: 56
73
+ labelColor: "#1a1a2e"
74
+ backgroundColor: "#ffcf33"
75
+ hoverColor: "#ffe066"
76
+ pressedColor: "#e6b800"
77
+ buttonAction: cta
78
+ transform:
79
+ position: [0, -120]
80
+ scale: [1, 1]
81
+ rotation: 0
82
+ layout:
83
+ enabled: true
84
+ horizontalAlign: center
85
+ verticalAlign: center
86
+ components:
87
+ - id: cta-action
88
+ type: user:CtaButton
89
+ enabled: true
90
+ config: {}
91
+ children: []
@@ -0,0 +1,65 @@
1
+ # Pix3 Scene File (YAML)
2
+ # Playable 3D — the tap-to-start INTRO overlay, in its own file so the
3
+ # game scene opens clean. `main.pix3scene` carries it as a one-line `instance:`
4
+ # reference marked `visible: false`, which hides it in the EDITOR only.
5
+ # `initiallyVisible: true` below is what play mode reads, so the gate is UP at
6
+ # t=0 — in an ad container that first tap is what unlocks browser audio.
7
+ # `user:GameFlow` hides it on the first tap.
8
+ #
9
+ # Edit it here, full-screen, in its own tab. To preview it composited over the
10
+ # game, tick the eye on `intro-overlay` in main.pix3scene — just do not commit
11
+ # that tick, or every iteration starts behind the dim again.
12
+ #
13
+ # Stable node ids (design/recipe.md is the contract — do not rename these):
14
+ # intro-overlay, intro-dim, intro-label
15
+ version: 1.0.0
16
+ metadata:
17
+ author: Pix3 Template
18
+ description: Intro overlay — dim plus a TAP TO START label
19
+ root:
20
+ - id: intro-overlay
21
+ type: Group2D
22
+ name: Intro Overlay
23
+ properties:
24
+ width: 1080
25
+ height: 1920
26
+ initiallyVisible: true
27
+ layout:
28
+ enabled: true
29
+ horizontalAlign: stretch
30
+ verticalAlign: stretch
31
+ children:
32
+ - id: intro-dim
33
+ type: ColorRect2D
34
+ name: Intro Dim
35
+ properties:
36
+ width: 1080
37
+ height: 1920
38
+ color: "#000000"
39
+ opacity: 0.65
40
+ transform:
41
+ position: [0, 0]
42
+ scale: [1, 1]
43
+ rotation: 0
44
+ layout:
45
+ enabled: true
46
+ horizontalAlign: stretch
47
+ verticalAlign: stretch
48
+ children: []
49
+ - id: intro-label
50
+ type: Label2D
51
+ name: Tap To Start
52
+ properties:
53
+ label: "TAP TO START"
54
+ labelFontSize: 72
55
+ labelColor: "#ffffff"
56
+ labelAlign: center
57
+ transform:
58
+ position: [0, 0]
59
+ scale: [1, 1]
60
+ rotation: 0
61
+ layout:
62
+ enabled: true
63
+ horizontalAlign: center
64
+ verticalAlign: center
65
+ children: []
@@ -0,0 +1,55 @@
1
+ /**
2
+ * CtaButton — the playable's call-to-action. Attach to a Button2D; on press it
3
+ * reports game end and logs the click. It deliberately does NOT open a store
4
+ * page: which URL a playable opens (and whether it opens one at all) is decided
5
+ * by the ad network at delivery time via `mraid.open` / `dapi.openStoreUrl`, so
6
+ * a hardcoded store URL in a template is a wrong default that ships a real
7
+ * navigation out of the game on every tap. Wire the network SDK here when you
8
+ * package the ad; until then the log is the whole contract.
9
+ *
10
+ * The press handler does nothing itself: it dispatches the named command
11
+ * `cta-click`, whose handler is the intent method `ctaClick()`. Keep that shape
12
+ * as you add buttons — a game whose reactions are named intents can be driven
13
+ * and tested by `scene.commands.dispatch(...)` rather than by simulated taps,
14
+ * the wiring survives any relayout of the UI, and one real tap is enough to
15
+ * prove the button still raises the intent it claims.
16
+ */
17
+ import { Script, playable } from '@pix3/runtime';
18
+ import type { NodeBase } from '@pix3/runtime';
19
+
20
+ export class CtaButton extends Script {
21
+ private disposeCommands: (() => void)[] = [];
22
+
23
+ onAttach(node: NodeBase): void {
24
+ node.connect('pressed', this, this.handlePressed);
25
+ }
26
+
27
+ onStart(): void {
28
+ // Registered here rather than in onAttach: `scene` is injected once the
29
+ // graph is built, which is after components are attached during load.
30
+ const commands = this.scene?.commands;
31
+ this.disposeCommands = [
32
+ commands?.register('cta-click', () => this.ctaClick(), {
33
+ description: 'Accept the call to action: end the session and report the CTA click.',
34
+ }),
35
+ ].filter((dispose): dispose is () => void => dispose !== undefined);
36
+ }
37
+
38
+ onDetach(): void {
39
+ for (const dispose of this.disposeCommands) {
40
+ dispose();
41
+ }
42
+ this.disposeCommands = [];
43
+ super.onDetach();
44
+ }
45
+
46
+ /** Intent: the player accepted the call to action — end the session and report the click. */
47
+ ctaClick(): void {
48
+ playable.gameEnd();
49
+ console.info(`[CtaButton] CTA clicked (${this.node?.name ?? this.node?.id ?? 'unknown node'})`);
50
+ }
51
+
52
+ private handlePressed = (): void => {
53
+ this.scene?.commands.dispatch('cta-click');
54
+ };
55
+ }