Skip to content

Kaplay.Layer

Modules

Comp

Values

addLayerComponent

layer(context, layerName)

Determines the layer for objects. Object will be drawn on top if the layer index is higher.

let addLayer: (Kaplay.Context.t, string) => Kaplay.Types.comp
Parameters
string
Return type
getLayer

Get the name of the current layer the object is assigned to. Will always be null if the game doesn't use layers.

let getLayer: T.t => null<string>
Parameters
T.t
Return type
Stdlib.null < string >
layerIndex

layerIndex(layer)

Get the index of the current layer the object is assigned to. Will always be null if the game doesn't use layers.

let layerIndex: T.t => null<int>
Parameters
T.t
Return type
Stdlib.null < int >
setLayer

Set the name of the layer the object should be assigned to. Throws an error if the game uses layers and the requested layer wasn't defined.

let setLayer: (T.t, string) => unit
Parameters
T.t
string
Return type
unit