Skip to content

Construct 3 SDK

Info

Looking for the old Construct 3 SDKs?

All the functionality of our SDK is showcased in this demo project. To avoid weird browser behavior, right-click the link, and select Save link as.

Requirements

When integrating the CrazyGames SDK, make sure to follow our requirements. They will help you use the SDK in the best way possible and guide you in terms of ad placements and account integration.

Installation

You will need to create a separate layout for loading and initializing the SDK. Our demo project contains an example layout called CrazySDKLoadingDemo. That layout should contain a System > On start of layout script with these contents:

const nextLayoutName = "CrazySDKDemo"; // don't forget to set the name of the next layout that should be loaded after initialization
const sdkElem = document.createElement("script");
sdkElem.type = "text/javascript";
sdkElem.src = "https://sdk.crazygames.com/Construct3CrazySDK-v3.js";
document.body.appendChild(sdkElem);
sdkElem.onload = function () {
    window.ConstructCrazySDK.init()
        .then(() => {
            runtime.goToLayout(nextLayoutName);
        })
        .catch((e) => console.log("Failed to init CrazySDK", e));
};
sdkElem.onerror = function () {
    console.error("Failed to load Construct3CrazySDK script.");
};

The script will load our SDK, initialize it, and continue to nextLayoutName.

Warning

The CrazyGames SDK is not working with Construct "Worker mode". "Worker mode" can be disabled by selecting your project in the "Project" panel, going to "Advanced", and setting "Use worker" to "No"

Development

When using our SDK with Construct preview, you will see fake ads. To see the real behavior of your game like it would be on Crazygames, use our QATool with the HTML5 engine.

About using the SDK

The SDK functionality is implemented in JavaScript, so to call various features from the SDK, you will need to add scripts to your event sheets. When right-clicking on your events, you will get an "Add script" option, which will add a small text editor where you can write the code.