Skip to main content

Cocos Creator integration

Cocos Creator 3.x games run as plain HTML5 builds, and the app injects the GameReels bridge before your first statement — so the package is one typed TypeScript wrapper you drop into your project.

Install

Download flickcade-sdk.ts from the downloads page and place it anywhere under assets/scripts/.

Minimum integration

TypeScript
import { flickcade } from './flickcade-sdk';
import { _decorator, Component, director } from 'cc';
const { ccclass } = _decorator;

@ccclass('GameRoot')
export class GameRoot extends Component {
    onLoad() {
        flickcade.on('appActive', () => { director.resume(); /* + resume audio */ });
        flickcade.on('appHidden', () => { director.pause();  /* + pause audio  */ });
        flickcade.ready(); // when gameplay could start
    }
}
Your game boots hidden — don't start gameplay or audio in onLoad; start on the first appActive (flickcade.visible reads the current state). Pause your AudioSources along with the director.

Gameplay events

TypeScript
flickcade.levelStart(3);
flickcade.levelEnd(3, 'win', { ms: 41200 });
flickcade.score(1250);
flickcade.reward('currency', 'coin', 25);
flickcade.custom('boss_phase', { n: 2 });
flickcade.adBreak();

Semantics and limits are the same as the JavaScript surface — see the API reference. Every call returns boolean — true when the bridge accepted the event — and flickcade.version reads the bridge version. Outside Flickcade (including the Creator preview browser) every call is a safe no-op returning false, so the same build runs everywhere unchanged.