Messaging Game Over

Ensures games created have a lose condition and send a message to the parent iframe in a standardized manner. Use when creating or modifying a game.

GoogleCloudPlatform 2c4a1cb 697 B Updated

File contents

Game Structure and iframe messaging

Follow these steps when creating a new game:

  1. Lose condition Ensure the game loop always has a "lose condition" that can be reached in which the player has failed.

  2. Iframe message When the failure state is reached, use the iframe post message feature to send a message from the current page up to the parent page of the site in the following format:

    window.parent.postMessage({ type: 'game-over', score: this.score, }, '*');

googlecloudplatform/devrel-demos/tree/main/other/antigravity-arcade/games/.agents/skills/messaging-game-over commit 2c4a1cb411

Frequently asked questions

npx skillmds@latest add googlecloudplatform/messaging-game-over