cocos_scaffold_score_system
Generate a score management system for Cocos Creator games with current/high score tracking, localStorage persistence, and optional UI label rendering.
Instructions
Generate GameScore.ts + meta - current/high score singleton with localStorage persistence and optional Label auto-render.
Runtime API::
GameScore.I.add(points) // bump current; update high if beaten
GameScore.I.reset() // clear current (high survives)
GameScore.I.current // number, current run's score
GameScore.I.high // number, best ever, persistedThe script has two optional @property(Label) slots:
scoreLabel renders 'Score: N' on every change, highLabel
renders 'High: N'. Wire them after attach::
cocos_set_uuid_property(scene, script_comp, 'scoreLabel', label_uuid)... or let the user hook them up from the inspector if they prefer.
High-score persistence uses localStorage under the key
cocos-mcp-high-score; write failures (private browsing,
WeChat mini-game) are swallowed so gameplay never crashes over
a missing save.
Returns {path, rel_path, uuid_standard, uuid_compressed}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | Yes | ||
| rel_path | No | GameScore.ts |