Options
All
  • Public
  • Public/Protected
  • All
Menu

Container which manages a pool of Particle objects (20 by default) and emits them in random directions when the play method is called.

Hierarchy

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

Properties

alpha

alpha: number

The opacity of the entity (from 0 to 1)

children

children: Partial<Entity>[]

An array of child entities for recursive update/render.

dead

dead: boolean

Whether or not the entity is dead.

pos

pos: Vec

Position of the entity.

scale

scale: Vec

Scale of the entity.

visible

visible: boolean

Whether or not the entity is visible.

Accessors

hasChildren

  • get hasChildren(): boolean

Methods

add

  • add<T>(child: T): T
  • Add and return a child object.

    Type parameters

    • T

    Parameters

    • child: T

      Object to add to the container.

    Returns T

map

  • map(fn: (child: Partial<Entity>, index?: number) => void): any
  • Map a function across all children.

    Parameters

    • fn: (child: Partial<Entity>, index?: number) => void

      Function to call for each child.

        • (child: Partial<Entity>, index?: number): void
        • Parameters

          • child: Partial<Entity>
          • Optional index: number

          Returns void

    Returns any

play

  • play(pos: Vec): void
  • 'Plays' the particle emitter effect.

    Parameters

    • pos: Vec

      Position to use for anchoring particles.

    Returns void

remove

  • remove<T>(child: T): T
  • Remove and return a child object.

    Type parameters

    • T

    Parameters

    • child: T

      Object to remove from the container.

    Returns T

update

  • update(dt: number, t: number): void
  • Update each child in the container.

    Automatically removes any child object marked as dead.

    Parameters

    • dt: number

      Delta time since last update.

    • t: number

      Timestamp in seconds.

    Returns void