platformer - v1.0.0
    Preparing search index...

    Class default

    Minimal Entity Component System (ECS) implementation.

    Stores component data by component type and entity id. Entities are represented by unique symbol identifiers.

    This implementation:

    • Stores only data (no systems)
    • Allows dynamic component registration
    • Supports simple entity queries
    Index

    Constructors

    Properties

    paused: boolean = false

    Whether simulation systems should update. Rendering may still occur while paused.

    Methods

    • Adds or replaces a component on an entity.

      If the component type does not yet exist in storage, it will be initialized automatically.

      Type Parameters

      • T extends object

        Component data type.

      Parameters

      • id: symbol

        Entity identifier.

      • name: Component

        Component type.

      • data: T

        Component data object.

      Returns void

    • Returns all components of a specific type.

      Useful for systems that operate on a single component class.

      Type Parameters

      • T extends object

        Component data type.

      Parameters

      Returns [symbol, T][]

      Array of [entityId, componentData] tuples.

    • Returns all entities that contain every specified component.

      The first component type is used as the base set, and the remaining component types are intersected.

      Parameters

      • ...componentNames: Component[]

        Component types required.

      Returns symbol[]

      Array of matching entity ids.

    • Retrieves a component from an entity.

      Type Parameters

      • T extends object

        Expected component type.

      Parameters

      • id: symbol

        Entity identifier.

      • name: Component

        Component type.

      Returns T | undefined

      Component data or undefined if not found.

    • Removes a specific component from an entity.

      Parameters

      • id: symbol

        Entity identifier.

      • name: Component

        Component type.

      Returns void

    • Removes an entity and all of its components.

      Parameters

      • id: symbol

        Entity identifier.

      Returns void