Game interface
Stay organized with collections
Save and categorize content based on your preferences.
Game lifecycle events and pause controls.
Methods
gameOver(): void
The user reached a game over event. Required
firstFrameReady(): void
Announces that the first frame is ready to be shown. Required
levelComplete(level: number): void
The user reached a level complete event. Required
onPause(callback: () => void): void
Subscribes to pause events. Required
onResume(callback: () => void): void
Subscribes to resume events. Required
ready(): void
The game has finished loading and is ready to play. Required.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-03 UTC."],[[["\u003cp\u003eThe Game API provides essential lifecycle events like \u003ccode\u003egameOver\u003c/code\u003e, \u003ccode\u003efirstFrameReady\u003c/code\u003e, \u003ccode\u003elevelComplete\u003c/code\u003e, and \u003ccode\u003eready\u003c/code\u003e to manage the game flow.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can manage pause and resume events using \u003ccode\u003eonPause\u003c/code\u003e and \u003ccode\u003eonResume\u003c/code\u003e methods to provide a smooth user experience.\u003c/p\u003e\n"],["\u003cp\u003eAll the aforementioned methods are required for game integration and should be implemented accordingly.\u003c/p\u003e\n"]]],[],null,["# Game interface\n\nGame lifecycle events and pause controls.\n\nMethods\n-------\n\n[`gameOver(): void`](./gameover) \n\nThe user reached a game over event. **Required**\n\n[`firstFrameReady(): void`](./firstframeready) \n\nAnnounces that the first frame is ready to be shown. **Required**\n\n[`levelComplete(level: number): void`](./levelcomplete) \n\nThe user reached a level complete event. **Required**\n\n[`onPause(callback: () =\u003e void): void`](./onpause) \n\nSubscribes to pause events. **Required**\n\n[`onResume(callback: () =\u003e void): void`](./onresume) \n\nSubscribes to resume events. **Required**\n\n[`ready(): void`](./ready) \n\nThe game has finished loading and is ready to play. **Required**."]]