ct represents the drawing canvas itself, extended with modules and core libraries. But let's talk a bit about how it all works.
These events are always executed in the following order:
oncreateevent, which is emitted when a user starts a game or navigates to a new room;
- main game loop occurs:
onstepevent is emitted for all the copies in the room;
onstepevent for current room is called;
ondestroyis called for all the copies marked to be
- all the copies are reordered, the canvas is cleaned here;
ondrawis called for all the copies;
ondrawis called for a room;
- input events are cleared. Waiting for a new game loop iteration.
- When a user moves to a new room, an
ondestroyevent is called for current (previous) room.
Methods and properties
Sets new max frames per second.
A read-only variable representing the current max FPS.
The drawing context of the main canvas.
The drawing canvas of the game.
Returns the metadata that you supplied inside the ct.js editor, such as