Construct 2 has been officially retired. Now you should upgrade to Construct 3.

Layer functions

Layouts consist of multiple layers. All layout objects belong to a layer.

Layer properties

layer.layout
A reference back to the layout the layer is on.
layer.runtime
A reference back to the runtime.
layer.scale
The current layer scale.
layer.viewLeft
layer.viewRight
layer.viewTop
layer.viewBottom
Defines the rectangle of the currently visible viewport. This may be larger or smaller than the canvas size if the scale is not 1.0.
layer.name
The layer name.
layer.index
The zero-based layer index.
layer.visible
A boolean indicating if the layer is currently visible.
layer.background_color
The layer's background color, as an array in the format [r, g, b, a]. Ignored if the layer is transparent.
layer.transparent
A boolean indicating if the layer is transparent.
layer.parallaxX
layer.parallaxY
The layer's parallax rate for the X and Y axes.
layer.opacity
The layer's opacity, from 0 (transparent) to 1 (opaque).
layer.forceOwnTexture
A boolean indicating the Force own texture setting.
layer.instances[]
An array of all the object instances (of any object type) currently on this layer.

Layer functions

layer.canvasToLayerX(x)
layer.canvasToLayerY(y)
Convert from canvas coordinates to layer coordinates. Useful for converting e.g. mouse co-ordinates to layer co-ordinates. See Mouse for an example.
Construct 2 Javascript SDK Manual 2020-06-05