Skip to content

environment-2d.entity overview


Table of contents


utils

Environment2dEntity (class)

Applies scene environment settings (see IVisualScene2dComponent.setEnvironment) while it is in the world, and restores whatever those fields were before once it is removed. This is what the 2D "Environment" level-JSON class creates, so a level's background goes away when the level is unloaded.

Several of these can be in one world at once (e.g. two levels loaded during a transition) and be removed in any order: each field shows the most recently spawned entity that sets it, and falls back to the value from before any of them once none is left.

Signature

export declare class Environment2dEntity<VTypeDoc> {
  constructor(public readonly environment: Partial<Environment2dOpts<VTypeDoc['texture']>>)
}

onSpawned (method)

Signature

onSpawned(world: Gg2dWorld<Gg2dWorldTypeDocVPatch<VTypeDoc>>)

onRemoved (method)

Signature

onRemoved()

tickOrder (property)

Signature

readonly tickOrder: TickOrder.OBJECTS_BINDING