/** * CoolGames SDK game config. * No need to change these values, they will be provided. */ var gameName = "Cool Game"; var gameCategory = "Puzzle"; var developerId = "0000"; var gameCode = "game_code"; var adChannel = "channelTEMP"; var gameAnalyticsId = "xxx"; /** * Load SDK * NOTE: path is relative and will work only after the game is published */ (function(w, d) { w.Booster = w.Booster || {}; var s = d.createElement("script"); var p = d.getElementsByTagName("script")[0]; s.async = 1; s.src = "/shared/booster/api.js"; s.setAttribute("id", "booster-api"); p.parentNode.insertBefore(s, p); })(window, document); /** * Will be automatically called when SDK is loaded */ Booster.ready = function() { new Booster.Init({ orientation: "portrait" // TODO: Set orientation ("portrait" | "landscape" | "both") }); adSense = new Booster.Ad({ channelID: adChannel }); community = new Booster.Community({ position: 1, gameCode: gameCode }); analytics = new Booster.Analytics({ gameName: gameName, gameId: gameCode, gameCategory: gameCategory, developer: developerId, gameAnalyticsId: gameAnalyticsId }); moregames = new Booster.Moregames(); banner = new Booster.AdBanner({}); banner.show(); /** * Function that is called when the game is ready to initialize. */ Booster.onSplashFinishedEvent = function() { // TODO: Initialize your game here /* window.game = new Phaser.Game(800, 600, Phaser.AUTO, "game", { create: create }); */ }; /** * Function that is called when the game should be paused. */ Booster.onOpenTab = function() { pauseGame(); }; /** * Function that is called when the game should be resumed. */ Booster.onCloseTab = function() { resumeGame(); }; }; function pauseGame() { // TODO: Pause your game here } function resumeGame() { // TODO: Resume your game here } /** * Example usage * You can keep this and call it if you have a level based game. * Otherwise you can use this as a reference to implement your own flow. */ function levelCompleted(level, score, returnCallback) { // Send analytics analytics.level(currentLevel); analytics.score(score); // Pause the game pauseGame(); // Submit the score for community features community.submitScore({ score: score, callback: function() { // After the score is submitted try show an advertisement adSense.showAdvertising({ callback: function() { // Resume the game resumeGame(); returnCallback && returnCallback(); } }); } }); } function levelFailed(level, returnCallback) { // Send analytics analytics.levelFailed(level); // Pause the game pauseGame(); // Show an advertisement adSense.showAdvertising({ callback: function() { // Resume the game resumeGame(); returnCallback && returnCallback(); } }); }