ct

About 1 min

ct

ct represents the game engine itself, extended with modules and core libraries. The core lib contains of:

You will usually use the API above, as well as those APIs provided by ct.js modules.

By itself, ct.js is based on Pixi.jsopen in new window, an HTML5 graphics library. You can use its API if you feel ct.js' one is not enough.

Methods and properties

ct.pixiApp

The Pixi.js applicationopen in new window of the game.

ct.stage

The game's root stageopen in new window.

ct.meta

Returns the metadata that you supplied inside the ct.js editor, such as author, site, version and name.

ct.delta

A multiplier that shows how much a current frame differs from the target FPS. It will change depending on game's performance. For example, it will be 2 at 30 FPS, as a target one is 60 FPS, and it will be 1 at completely smooth target framerate.

You can use this delta while designing movement, so things move uniformly at any framerate, e.g.:

this.x += 10 * ct.delta;

But this delta is mostly useful while designing complex or logic-driven movement, as the default movement system already takes ct.delta into account.

ct.deltaUi

ct.deltaUi is similar to ct.delta, but it ignores time scaling factors that can happen during slow-mo effects or game pause (see "Pausing a game" for examples).

Loading...