This object manages your rooms and current view (camera).
Methods and properties
Destroys all the existing copies and moves to a new room.
This action also resets all the drawing settings, like fill color, opacity, etc. You might need to set them again.
Destroys all the existing copies in the room.
The current room's object.
Existing rooms to switch to.
A function that is called by a room to create its copies, backgrounds and tiles on load. It is mostly an internal function that is not intended for use in ct.IDE, but you still can use this method to add copies from one room to existing one. The method returns an array of all the created copies, including tile layers and backgrounds. Example:
this.interfaceCopies = ct.rooms.make.apply(ct.rooms.templates.MainInterface);
Managing current viewport
You can manage the viewport anytime by editing properties listed below of
ct.rooms.current object. You can also use
this keyword in room's events.
Current horizontal and vertical shift of the view.
The size of current room.
You can set a copy to follow here, so the camera moves to it automatically.
Horizontal and vertical padding from the edges of the canvas, within which the camera moves.
// Place this code, e.g, to your hero's `OnCreate` code var room = ct.rooms.current; room.follow = this; // Follow the hero so it is always at the center of the screen room.borderx = room.width / 2; room.bordery = room.height / 2;