API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classObjectLayer

@codexo/exojs-tilemap / tilemap / stable

A data-only layer of TileMapObjects - spawn points, trigger zones, collision regions, markers. Object layers are not rendered by the tile renderer; they are parsed and exposed for gameplay use (e.g. building physics colliders, placing entities). The presentation fields the source format attaches to a layer - visible, opacity, offsetX/offsetY, parallaxX/parallaxY, parallaxScale, and tintColor - are carried through in full, with any enclosing group layers' contribution already folded in, so an object layer describes the same placement and shading its neighbouring tile and image layers do. Nothing here acts on them: code that draws these objects itself is what applies them. Query with query (untyped, fully back-compatible) or, when an ObjectSchema type argument `S` is supplied, with the typed accessors byType, byKind, and where - these narrow `properties` to the developer-declared shape. The schema is **opt-in**: the default type parameter reproduces the original untyped behaviour, so `new ObjectLayer(options)` and `map.getObjectLayer('x')` are unchanged.

15
props
6
methods
0
events
Import
import { ObjectLayer } from '@codexo/exojs-tilemap'

A data-only layer of TileMapObjects - spawn points, trigger zones, collision regions, markers. Object layers are not rendered by the tile renderer; they are parsed and exposed for gameplay use (e.g. building physics colliders, placing entities).

The presentation fields the source format attaches to a layer - visible, opacity, offsetX/offsetY, parallaxX/parallaxY, parallaxScale, and tintColor - are carried through in full, with any enclosing group layers' contribution already folded in, so an object layer describes the same placement and shading its neighbouring tile and image layers do. Nothing here acts on them: code that draws these objects itself is what applies them.

Query with query (untyped, fully back-compatible) or, when an ObjectSchema type argument `S` is supplied, with the typed accessors byType, byKind, and where - these narrow `properties` to the developer-declared shape. The schema is **opt-in**: the default type parameter reproduces the original untyped behaviour, so `new ObjectLayer(options)` and `map.getObjectLayer('x')` are unchanged.

Constructors1
Methods6
byKind(kind: K): Extract<EllipseObjectAn ellipse inscribed in `[x, y, width, height]`.<TilePropertiesAn immutable, flat key-value bag of generic tile properties. Adapters copy and freeze source properties; the runtime never retains a caller-owned mutable objec…>, { kind: K }> | Extract<PointObjectA single point at `(x, y)`.<TilePropertiesAn immutable, flat key-value bag of generic tile properties. Adapters copy and freeze source properties; the runtime never retains a caller-owned mutable objec…>, { kind: K }> | Extract<PolygonObjectA closed polygon; `points` are relative to the object origin.<TilePropertiesAn immutable, flat key-value bag of generic tile properties. Adapters copy and freeze source properties; the runtime never retains a caller-owned mutable objec…>, { kind: K }> | Extract<PolylineObjectAn open polyline; `points` are relative to the object origin.<TilePropertiesAn immutable, flat key-value bag of generic tile properties. Adapters copy and freeze source properties; the runtime never retains a caller-owned mutable objec…>, { kind: K }> | Extract<RectangleObjectAn axis-aligned rectangle object spanning `[x, y, width, height]`.<TilePropertiesAn immutable, flat key-value bag of generic tile properties. Adapters copy and freeze source properties; the runtime never retains a caller-owned mutable objec…>, { kind: K }> | Extract<TextObjectA text object carrying styled text content within `[x, y, width, height]`.<TilePropertiesAn immutable, flat key-value bag of generic tile properties. Adapters copy and freeze source properties; the runtime never retains a caller-owned mutable objec…>, { kind: K }> | Extract<TileObjectA tile (GID) object carrying a resolved tile reference. `x`/`y` are the top-left corner of the bounding box, the same convention as every other object kind. So…<TilePropertiesAn immutable, flat key-value bag of generic tile properties. Adapters copy and freeze source properties; the runtime never retains a caller-owned mutable objec…>, { kind: K }>[]
Objects of the given geometry ObjectKind, narrowed to that geometry's member type (e.g. byKind(ObjectKind.Polygon) yields PolygonObjects with their points). Returns a fresh array.
Objects whose type equals type, with properties narrowed to the schema shape S[T]. Returns a fresh array (insertion order). The narrowing is a static convenience only - no runtime validation is performed (see ObjectSchema). On an unschematised layer this behaves like query({ type }) with TileProperties properties.
Objects of type (typed as in byType) that also satisfy predicate. A convenience combination of byType and Array.filter that keeps the narrowed properties type inside the predicate. Returns a fresh array.
Properties15
class: string
Layer class string.
drawOrder: "index" | "topdown"
Draw order for the objects (Tiled draworder). Informational.
id: number
Layer id (unique within the map).
kind: "object"
Layer-kind discriminant (distinguishes object layers from tile layers).
name: string
Layer name.
offsetX: number
Layer pixel offset X.
offsetY: number
Layer pixel offset Y.
opacity: number
Layer opacity in [0, 1].
parallaxScale: number
Uniform scale applied around the layer origin by consumers that render this data-only layer.
parallaxX: number
Parallax scroll factor on the X axis - the same quantity import('./TileLayer').TileLayer.parallaxX carries, so an object layer authored beside a tile layer in the same parallax group reports the same factor. 1 = full camera speed, 0.5 = half speed, 0 = stationary. Nothing in this package applies it: object layers are data-only, so placing an object relative to the camera is the consumer's job (see ObjectLayer).
parallaxY: number
Parallax scroll factor on the Y axis. See ObjectLayer.parallaxX.
tintColor: null | number
Multiplicative layer tint as 0xRRGGBB, or null for no tint. Carried from the source map (including the accumulated tint of any enclosing group layers) for code that draws these objects itself; like ObjectLayer.parallaxX, nothing in this package applies it.
visible: boolean
Whether the layer is visible.
Source