Skip to main content

Snapshot

A snapshot is a picture of the deck's current frame that a player collects into their Castle inventory, free or for bricks. It is the same item a classic deck makes with its "offer snapshot" rule. The player can also take one any time with the camera button in the feed; the deck is not involved in that one.

Snapshot.offer(options?): Promise<SnapshotOfferResult>​

Captures the current frame and shows Castle's collect card over it; resolves when the player collects or closes it. options:

  • title, description — shown on the card. With no title the card reads "A snapshot of @creator's deck".
  • price — bricks. 0 or absent is free; otherwise a whole number from 5 to 9995. Anything else throws INVALID_ARGUMENT.

Collecting works only in the Castle mobile app; the website shows "collect in the app" and the dev server a short notice, and both resolve unavailable. offer was added to the app on 2026-09-22; an app build from before then rejects it with UNKNOWN_COMMAND (see CastleError), so catch it where a deck has to keep going without the card. SnapshotOfferResult has a status:

  • 'collected' — the player collected it.
  • 'cancelled' — the player closed the card.
  • 'unavailable' — can't collect here, or another snapshot card is already open (a second offer while one is open gets this and the first carries on).
const { status } = await Snapshot.offer({
title: "Level 3 cleared",
description: `${score} points`,
});

A snapshot is not the deck's cover, and no SDK call sets the cover. A cover the creator chose by hand is kept; otherwise save-deck photographs the deck as it opens, falling back to a preview.png the deck folder holds when that capture does not produce one.

Snapshot.onTaken(handler): () => void​

Registers a function called just before an offer's capture, the twin of the classic "snapshot taken" trigger. Change what's on screen in it — hide the HUD, pose the character — and the capture shows the next painted frame. Returns a function that unregisters it. The camera button never calls it.

Snapshot.onTaken(() => {
hud.hidden = true;
});