# Room class

Rooms are the entities that contain all the copies, backgrounds, tile layers, and advanced entities, too. They are also referred to as maps and levels.

Rooms derive from PIXI.Container (opens new window) class, and inherit all its methods and properties.

# The current room, ct.room.

ct.room always points to the current room. If you have multiple rooms layered on top of each other, ct.room will point to the initial room that was created at the start of a game, or after calling ct.rooms.switch.

To get layered rooms, you can use ct.rooms.list, or this.getRoom inside copies' events.

# UI and Gameplay rooms

Rooms can be put either into UI coordinate space or gameplay coordinate space. Gameplay rooms are managed by ct.camera, and cannot be moved manually. But UI rooms can be: for example, to move smaller widgets around the viewport.


More about this concept at Game and UI Coordinates. For viewport management, see Working with Viewport.

# Notable properties

Property Type Description
alpha number A value from 0 to 1 that sets room's opacity. You can use it, for example, to gradually fade in/fade out UI layers. 0 means fully transparent, and 1 means fully opaque.
isUi boolean If set to true, the room will be unaffected by camera scaling, movement, and rotation. See more at Game and UI Coordinates.
x, y number The location of a room. Changing these have no effect if the room is in gameplay coordinates (if its isUi property is false)
Last Updated: 9/30/2020, 11:20:52 PM