GameSnacks Developer SDK

The GameSnacks Developer SDK provides various features to games hosted on GameSnacks.

You don't need to load any scripts; the SDK is automatically loaded for all games hosted on GameSnacks.

GameSnacks interface

The main interface is GameSnacks and an instance of this is available as the GameSnacks property on window.

Features marked as required must be integrated into your game following all requirements listed within these features.

Properties

ad: Ad
Methods for displaying in-game advertising. Required

audio: Audio
Methods for controlling audio. Required

game: Game
Game lifecycle events and pause controls. Required

score: Score
Methods for updating the user's score. Required

storage: Storage
Methods for persisting game and save data. Required

Examples

// Register lifecycle event handlers.
GameSnacks.game.onPause(() => {
  // Display pause screen.
  engine.scene("pauseScreen").setVisible();
  // Pause game loop.
  engine.loop.sleep();
});
GameSnacks.game.onResume(...);

// Set up audio controls.
engine.sound.setMute(!GameSnacks.audio.isEnabled);
GameSnacks.audio.subscribe((isEnabled) => engine.sound.setMute(!isEnabled));

// Announce that the game is ready to be shown.
GameSnacks.game.firstFrameReady();