setLayers(layers: string[], defaultLayer: string): void

Define the layer names. Should be called before any objects are made.

paramlayers- The layer names.

paramdefaultLayer- The default layer name.

layers(["bg", "obj", "ui"], "obj")

// no layer specified, will be added to "obj"
add([
     sprite("bean"),
]);

// add to "bg" layer
add([
    sprite("bg"),
    layer("bg"),
]);

sincev3001.1

kaplay logo

Misc

Layer