Skip to main content

Construct

Funox supports Construct 3 via a small loader pattern.

Install

In your loading layout (the first layout your game opens), add a Script action that dynamically loads the Funox SDK:

JavaScript12 lines
1const sdkElem = document.createElement("script");2sdkElem.src = "https://sdk.funox.com/construct/funox-construct-v1.js";3document.body.appendChild(sdkElem);4 5sdkElem.onload = function () {6    window.ConstructFunoxSDK.init()7        .then(() => runtime.goToLayout("MainMenu"))8        .catch((e) => {9            console.warn("Funox SDK init failed", e);10            runtime.goToLayout("MainMenu");11        });12};

Lifecycle

JavaScript5 lines
1window.ConstructFunoxSDK.game.gameplayStart();2window.ConstructFunoxSDK.game.gameplayStop();3window.ConstructFunoxSDK.game.loadingStart();4window.ConstructFunoxSDK.game.loadingStop();5window.ConstructFunoxSDK.game.happytime();

Video ads

JavaScript5 lines
1window.ConstructFunoxSDK.ad.requestAd("midgame", {2    adStarted:  () => runtime.callFunction("PauseGame"),3    adFinished: () => runtime.callFunction("ResumeGame"),4    adError:    () => runtime.callFunction("ResumeGame"),5});

Save data

JavaScript2 lines
1window.ConstructFunoxSDK.data.setItem("highScore", "12450");2const score = window.ConstructFunoxSDK.data.getItem("highScore");

Tips

  • Use Construct's Function feature to expose SDK callbacks back into your event sheet.
  • Avoid heavy work during loading-layout — the SDK init is fast, but tile pre-loading isn't.
  • Keep effects on CPU-friendly settings for mobile.