Skip to content

Construct 3 (old)


This SDK is in beta and still under development. Note that future releases may not be backwards compatible, and that we’d ask you to update your game. You can give feedback using our contact form.


The CrazyGames SDK is not working with Construct "Worker mode". It is disabled by default as soon you add a script. If you have forced the "Use worker" mode to "Yes", please turn it off.

Worker mode


To add the Crazygames SDK to your Construct 3 game, add a script to your project by right clicking to the "Scripts" folder and then clicking on "Add script".

Add Construct3 script

Then replace the content of the newly created script file by the following code:

const sdkElem = document.createElement("script");
sdkElem.type = "text/javascript";
sdkElem.src = "";


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.


All features can be called using javascript functions. To do so, you need to add script parts to your event sheet by right clicking and pressing “Add script”.

Add Construct3 function

You’ll then get a text editor where you can write JavaScript code.

Ad breaks

Guidelines for Advertisements

Please be sure to read our advertisement guidelines, since your game will be rejected without any feedback if it doesn't follow them.

Playing an ad break

Ad breaks can be requested using the displayAd() function. You’ll have to make sure to pause your game before playing the ad by setting the time scale to 0 (System action). Then use the Wait for previous action system event and resume the game when the ad finishes by setting the time scale back to 1. Your event sheet should look like this:

Display ad

Ad Types

We support two different types of ad breaks: midgame and rewarded. Midgame advertisements can happen when a user dies, a level has been completed, etc. Rewarded advertisements can be requested by the user in exchange for a reward (An additional life, a retry when the user died, a bonus starting item, extra starting health, etc.). Rewarded ads should be shown when users explicitly consent to watch an advertisement. displayAd() has an argument that indicates the ad type. You can request both types as follows:

await crazysdk.displayAd("midgame");
await crazysdk.displayAd("rewarded");

Ad banners

Our SDK allows you to display ad banners directly into your game. Here are the available sizes:

  • 728x90 (Leaderboard)
  • 300x250 (Medium)
  • 320x50 (Mobile)
  • 468x60 (Main)
  • 320x100 (Large Mobile)

Displaying banners

To request ad banners you can call the displayBanners() function like in the following code:

    id: "banner1",
    x: 50,
    y: 20,
    width: 300,
    height: 250,

You have to specify all 5 parameters for each banner:

  • id: a unique id to identify the banner
  • x: the vertical position of the banner from the top-left corner in pixels.
  • y: the horizontal position of the banner from the top-left corner in pixels
  • width: the banner width (see available banners list).
  • height: the banner height (see available banners list).


  • You can display up to two banners of each size at the same time at once (ex: 728x90 and 300x250, two 300x250, ...). We ask you to make a reasonable usage of banners in order not to deteriorate the player’s experience.
  • You can refresh a banner simply by re-executing the banner request. You'll have to wait a minimum of 60 seconds before refreshing a banner. You can do a maximum of 60 refreshes per banner for a game session.
  • The banner has to be fully inside the game window and not overlap with any UI element.
  • If you want to display multiple banners on a screen, you must request them at the same time:
    id: "banner1",
    x: 50,
    y: 20,
    width: 300,
    height: 250,
    id: "banner2",
    x: 0,
    y: 200,
    width: 728,
    height: 90,
  • To remove a banner use the removeBanner() function. You need to explicitly remove banners when they should no longer be displayed.

This feature lets you share the Crazygames version of your game to the players and invite them to join a multiplayer game. You can call inviteLink() with a map of parameters that correspond to your game or game room. You can assign the invite link value to a global variable as follows:

runtime.globalVars.InviteLink = crazysdk.inviteLink({ roomId: 12345 });

You can check for invite parameters with the getInviteParameter() function as follows.

runtime.globalVars.RoomId = crazysdk.getInviteParameter("roomId");


We provide functions that enable us to track when and how users are playing your games. These can be used to ensure our site does not perform resource intensive actions while a user is playing. The gameplayStart() function has to be called whenever the player starts playing or resumes playing after a break (menu/loading/achievement screen, game paused, etc.). The gameplayStop() function has to be called on every game break (entering a menu, switching level, pausing the game, ...). Don't forget to call gameplayStart() when gameplay resumes.

// Main menu, user clicks start
// Level is over, displaying switching level screen
// Next level starts
// The player is pausing the game by looking into the menu
// The player closes the menu and gets back to the game

Happy time

You can call the happytime() function when a player earns an achievement. Festive elements will be displayed on Crazygames.


Use this feature sparingly, the celebration should remain a special moment.

// Player beats a boss, reaches a high score, etc.

// Player finishes a level, gets an item, etc.
// No need to celebrate

Adblock Detection

We detect whether the user has installed an adblock tool. We pass this information to the developer through the hasAdBlock() function. That function returns a boolean that you can assign to a global variable (make sure that your variable type is also boolean):

runtime.globalVars.HasAdBlock = await crazysdk.hasAdBlock();


We require games to function even when the user has an adblock. The detection is not foolproof, and it would be very frustrating for a user not running any adblock to get a non-functional game. You can block extra content, such as custom skins, or some levels, to motivate the user to turn off their adblock. Also, keep in mind that turning off the adblock usually requires a page refresh. Make sure that the progress is saved, or the user may just decide to stop playing your game.