GameMaker

Connect your game with our SDKs

GameDistribution SDK for

Game Maker Studio 2

Make sure you have an account and your game is registered on developer.gamedistribution.com

Download the latest version of the plugin from here: GameMaker

•Import the Extension Package into your project.

•Before you can start your project, you must export your HTML5 project into an empty folder. 

In this folder, open up the index.html with a preferred text editor.

•Go down below in the index.html and insert the following code right after <!-- Run the game code -->

  <script type="application/javascript">
    window["GD_OPTIONS"] = {
    "gameId": "CHANGE THIS WITH YOUR GAME ID",
    "onEvent": function(ev) {
        var map = {};
        map["id"] = "gamedistribution";
        map["event"] = ev.name;
        GMS_API.send_async_event_social(map);
        }
    }

    (function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s);
    js.id = id;
    js.src = 'https://html5.api.gamedistribution.com/main.min.js';
    fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'gamedistribution-jssdk'));
  </script> 
•Change the gameId value with your gameID, which you can obtain from your GameDistribution control panel.
•Do not touch any other elements as this will break your game. 

Eventually, the page should look like this

•Save the index.html. Drag & drop this index file into your Game Maker project. It should go right under the Included Files section.
•Go to your game’s HTML5 Options, select the index.html file as “Included file as index.html”

You’re all set now!

MANDATORY SETTINGS

•You must set your gameId before you can use any of the GameDistribution SDK features.
•When you receive “SDK_GAME_PAUSE” in Social Async Event, you must volume down your game (preferably with audio_master_gain(0); or by your choice)
•To test your game, you can upload it to GameDistribution control panel and check it out with the revision link.

DOCUMENTATION

gd_ads_available();

Description : Checks if ads are available.

Returns : true / false (bool)

gd_open_console();

Description : Opens up the console. Used for debugging purposes.
Returns : N/A

gd_rewarded_available();

Description : Checks if rewarded ads are available.
Returns : true / false (bool)

gd_ads_show();

Description : Displays an interstitial ad.
### Returns : A Social Async Event
### async_load[“id”] = “gamedistribution” (string)

async_load[“event”] = “SHOW_ADS” (string)

async_load[“status”] = true or false (bool)

gd_rewarded_preload(adSlot);


Description : Preloads a rewarded ad. Before displaying a rewarded ad, this function must be used. Preloaded rewarded ads are stored under the name you give as adSlot.

Returns : A Social Async Event

async_load[“id”] = “gamedistribution” (string)

async_load[“event”] = “PRELOAD_REWARDED” (string)

async_load[“ad_slot”] = The parameter you’ve set (string)

async_load[“status”] = 1 : Successfuly, 0 : Failed, -1 : Rewarded Ads are not available. (real)

gd_rewarded_show(adSlot);


Description : Displays a rewarded ad.
### Returns : A Social Async Event

async_load[“id”] = “gamedistribution” (string)

async_load[“event”] = “SHOW_REWARDED” (string)

async_load[“ad_slot”] = The parameter you’ve set (string)

async_load[“status”] = true / false (bool)