Scripting
Pink Demo's main logic is in assets/scripts/ClickGame.ts. It binds existing scene UI nodes, with a recovery path for missing nodes. The normal gameplay path registers clicks, updates the score, moves the target through fixed positions, and resets the game.
Development workflow
- Locate
ClickGame.tswith Quick Open. - Read the relationships between
start(),onTargetClicked(), andresetGame(). - Watch type checks and the Problems panel while editing.
- Save and wait for language services and COCOS compilation to update.
- Run
main.sceneand verify the score cycle 0 → 1 → 0.
Checks after editing
Search all references before changing TARGET_POSITIONS or an asset path.
Check for duplicate event registration, node-validity checks in asynchronous asset callbacks, and restoration of score, position, and scale on reset.
TARGET_POSITIONS is deterministic. Keep its order stable when adding positions and check modulo indexing. For onTargetClicked(), test the immediate state update, movement after the animation, and repeated rapid clicks. For resetGame(), confirm that an old tween cannot move the reset target again.
APIs and versions
Use APIs for the project's declared COCOS version. Pink Demo's prerequisite is listed in First AI change.
PinK extension APIs and game runtime APIs are separate. Do not import internal editor APIs into game scripts.