Skip to content

Cocos

Info

This SDK is in beta and still under development.

Installation

Download the Cocos SDK.

Right-click on the assets folder in the Assets panel and select Import Asset Package.

Import step 1

Be sure all the files are selected and click Import.

Import step 2

You can now open the CrazySDK/CrazySDKDemo scene to view the functionality of the SDK.

Demo scene

To use the SDK, import it into your files:

import CrazySDK from "./CrazySDK";

Development

On localhost or 127.0.0.1 the SDK starts into local mode. This will do the following things:

  • The calls to request rewarded and midgame videos will display an overlay text.
  • SDK console logging will be enabled.

If you want to enforce the local mode on other domain/ip, you can do it by appending the ?useLocalSdk=true query parameter to the URL in your browser.

On CrazyGames domains, the SDK will work as expected.

On any other domains (or any other platforms, for example Android, iOS, Windows etc.), the SDK is disabled. This means all the method calls to the SDK will throw errors about the SDK beeing disabled. To prevent this, we recommend that you check if the SDK is enabled before calling any methods from it.

You can find if the SDK is enabled like this:

CrazySDK.isEnabled;

Ad module

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.

The ad module contains functionality for displaying video ads and for detecting adblockers. It can be accessed like this:

CrazySDK.ad;

The ad module is similar to the one from HTML SDK. You can find the docs for it here.

Game module

The game module contains various functionality related to the game. It can be accessed like this:

CrazySDK.game;

The game module is similar to the one from HTML SDK. You can find the docs for it here.

Other modules

The banner and user modules will be available later.