Skip to main content

ParticleArgs

Hierarchy

  • Partial<ParticleImpl>
    • ParticleArgs

Index

Properties

optionalacceleration

acceleration?: Vector

publicoptionalactive

active?: boolean = true

Whether this entity is active, if set to false it will be reclaimed

publicoptionalbeginColor

beginColor?: Color = Color.White

children

children: readonly Entity<any>[]

publicoptionalchildrenAdded$

childrenAdded$?: Observable<Entity<any>> = ...

publicoptionalchildrenRemoved$

childrenRemoved$?: Observable<Entity<any>> = ...

publicoptionalcomponentAdded$

componentAdded$?: Observable<Component> = ...

publicoptionalcomponentRemoved$

componentRemoved$?: Observable<Component> = ...

publicoptionalreadonlycomponents

components?: Map<Function, Component> = ...

Current components on the entity

Do not modify

Use addComponent/removeComponent otherwise the ECS will not be notified of changes.

optionalcurrentRotation

currentRotation?: number

publicoptionalelapsedMultiplier

elapsedMultiplier?: number = 0

emitter

publicoptionalendColor

endColor?: Color = Color.White

publicoptionalendSize

endSize?: number

publicoptionalevents

events?: EventEmitter<EntityEvents> = ...

Listen to or emit events for an entity

publicoptionalfadeFlag

fadeFlag?: boolean = false

publicoptionalfocus

focus?: Vector = null

publicoptionalfocusAccel

focusAccel?: number = 0

publicoptionalgraphics

publicoptionalid

id?: number = ...

The unique identifier for the entity

isInitialized

isInitialized: boolean

publicoptionalisOffscreen

isOffscreen?: boolean = false

publicoptionallife

life?: number = 300

publicoptionalname

name?: string = ...

publicoptionalopacity

opacity?: number = 1

parent

parent: Entity<any>

optionalparticleRotationalVelocity

particleRotationalVelocity?: number

optionalparticleSize

particleSize?: number

optionalparticleSprite

particleSprite?: Graphic

optionalposition

position?: Vector

publicoptionalscene

scene?: Scene<unknown> = null

The current scene that the entity is in, if any

publicoptionalsizeRate

sizeRate?: number = 0

publicoptionalstartSize

startSize?: number

publicoptionaltagAdded$

tagAdded$?: Observable<string> = ...

publicoptionaltagRemoved$

tagRemoved$?: Observable<string> = ...

tags

tags: Set<string>

publicoptionaltransform

transform?: TransformComponent

types

types: ComponentCtor[]

optionalvelocity

velocity?: Vector

publicoptionalvisible

visible?: boolean = true

Methods

publicoptionaladdChild

  • Adds an entity to be a child of this entity


    Parameters

    Returns Entity<any>

publicoptionaladdComponent

  • addComponent<TComponent>(component: TComponent, force?: boolean): Entity<any>
  • Adds a component to the entity


    Type parameters

    Parameters

    • component: TComponent

      Component or Entity to add copy of components from

    • force: boolean = false

      Optionally overwrite any existing components of the same type

    Returns Entity<any>

publicoptionaladdTag

  • addTag(tag: string): Entity<any>
  • Adds a tag to an entity


    Parameters

    • tag: string

    Returns Entity<any>

publicoptionaladdTemplate

  • addTemplate(templateEntity: Entity<any>, force?: boolean): Entity<any>
  • Adds a copy of all the components from another template entity as a "prefab"


    Parameters

    • templateEntity: Entity<any>

      Entity to use as a template

    • force: boolean = false

      Force component replacement if it already exists on the target entity

    Returns Entity<any>

publicoptionalclearComponents

  • clearComponents(): void
  • Returns void

publicoptionalclone

  • Creates a deep copy of the entity and a copy of all its components


    Returns Entity<any>

publicoptionalemit

  • emit<TEventName>(eventName: TEventName, event: EntityEvents[TEventName]): void
  • emit(eventName: string, event?: any): void

optionalget

publicoptionalgetAncestors

  • Returns a list of parent entities starting with the topmost parent. Includes the current entity.


    Returns Entity<any>[]

publicoptionalgetComponents

  • Returns all component instances on entity


    Returns Component[]

publicoptionalgetDescendants

  • getDescendants(): Entity<any>[]
  • Returns a list of all the entities that descend from this entity. Includes the current entity.


    Returns Entity<any>[]

publicoptionalhas

  • Check if a component type exists


    Type parameters

    Parameters

    Returns boolean

optionalhasAll

  • hasAll<TComponent>(requiredTypes: ComponentCtor<TComponent>[]): boolean
  • Verifies that an entity has all the required types


    Type parameters

    Parameters

    Returns boolean

optionalhasAllTags

  • hasAllTags(requiredTags: string[]): boolean
  • Verifies that an entity has all the required tags


    Parameters

    • requiredTags: string[]

    Returns boolean

publicoptionalhasTag

  • hasTag(tag: string): boolean
  • Check if a tag exists on the entity


    Parameters

    • tag: string

      name to check for

    Returns boolean

publicoptionalisKilled

  • isKilled(): boolean
  • Returns boolean

publicoptionalkill

  • kill(): void
  • Returns void

publicoptionaloff

  • off<TEventName>(eventName: TEventName, handler: Handler<EntityEvents[TEventName]>): void
  • off(eventName: string, handler: Handler<unknown>): void
  • off(eventName: string): void

publicoptionalon

publicoptionalonInitialize

  • onInitialize(engine: Engine<any>): void
  • onInitialize is called before the first update of the entity. This method is meant to be overridden.

    Synonymous with the event handler .on('initialize', (evt) => {...})


    Parameters

    Returns void

publicoptionalonPostUpdate

  • onPostUpdate(engine: Engine<any>, delta: number): void
  • Safe to override onPostUpdate lifecycle event handler. Synonymous with .on('postupdate', (evt) =>{...})

    onPostUpdate is called directly after an entity is updated.


    Parameters

    • engine: Engine<any>
    • delta: number

    Returns void

publicoptionalonPreUpdate

  • onPreUpdate(engine: Engine<any>, delta: number): void
  • Safe to override onPreUpdate lifecycle event handler. Synonymous with .on('preupdate', (evt) =>{...})

    onPreUpdate is called directly before an entity is updated.


    Parameters

    • engine: Engine<any>
    • delta: number

    Returns void

publicoptionalonce

publicoptionalremoveAllChildren

  • removeAllChildren(): Entity<any>
  • Removes all children from this entity


    Returns Entity<any>

publicoptionalremoveChild

  • Remove an entity from children if it exists


    Parameters

    Returns Entity<any>

publicoptionalremoveComponent

  • removeComponent<TComponent>(typeOrInstance: TComponent | ComponentCtor<TComponent>, force?: boolean): Entity<Exclude<any, TComponent>>
  • Removes a component from the entity, by default removals are deferred to the end of entity update to avoid consistency issues

    Components can be force removed with the force flag, the removal is not deferred and happens immediately


    Type parameters

    Parameters

    • typeOrInstance: TComponent | ComponentCtor<TComponent>
    • force: boolean = false

    Returns Entity<Exclude<any, TComponent>>

publicoptionalremoveTag

  • removeTag(tag: string): Entity<any>
  • Removes a tag on the entity

    Removals are deferred until the end of update


    Parameters

    • tag: string

    Returns Entity<any>

publicoptionalunparent

  • unparent(): void
  • Unparents this entity, if there is a parent. Otherwise it does nothing.


    Returns void

publicoptionalupdate

  • update(engine: Engine<any>, delta: number): void
  • Parameters

    • engine: Engine<any>
    • delta: number

    Returns void