Game Completion
Add proper game completion signaling so Puzzmo knows when the player has finished.
Steps
-
Find the game's win condition / completion check.
-
When the game is won, call
sdk.gameCompleted()with gameplay metrics:sdk.gameCompleted({ pointsAwarded: calculateScore(), elapsedTimeSecs: sdk.timer.timeSecs(), additionalTimeAddedSecs: sdk.timer.addedTimeSecs(), hintsUsed: hintsUsed, resetsUsed: 0, metric1: 0, metric2: 0, metric3: 0, metric4: 0, metricStrings: [], cheatsUsed: 0, }) -
After any victory animation completes, call
sdk.showCompletionScreen():sdk.showCompletionScreen( [ { type: "md", text: "**Congratulations!** You solved the puzzle!" }, ], gameplayData, true // showRetry ) -
Make sure
gameCompletedis called BEFOREshowCompletionScreen. The host processes the completion data first, then displays the completion UI. -
The timer automatically stops when
gameCompletedis called - you don't need to stop it manually.
Success Criteria
npm run buildcompletes without errors- When the game is won,
gameCompletedfires with score data - After victory animation,
showCompletionScreenfires - The completion flow works: play -> win -> gameCompleted -> animation -> showCompletionScreen