GameSnacks Developer SDK
Stay organized with collections
Save and categorize content based on your preferences.
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. 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();
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-25 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-25 UTC."],[[["The GameSnacks Developer SDK automatically loads and provides essential features for games hosted on the platform."],["Games must integrate the required features: advertising, audio controls, game lifecycle management, score updates, and data storage."],["The SDK offers a straightforward interface through the `GameSnacks` global object, granting access to functionalities like displaying ads or controlling the game's audio."],["Developers can utilize the provided methods and event handlers to seamlessly integrate their games with the GameSnacks platform."]]],[]]