Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Entity

Hierarchy

Index

Constructors

constructor

Properties

Protected _children

_children: Entity[]

Private _collisionable

_collisionable: boolean

Private _eventEmitted

_eventEmitted: boolean

Protected _model

_model: EntityModel

Private _modelCB

_modelCB: function

Type declaration

    • (attribute: string, value: any, oldValue: any): void
    • Parameters

      • attribute: string
      • value: any
      • oldValue: any

      Returns void

Private _modified

_modified: boolean

Private _notifierKeys

_notifierKeys: string[]

Protected _parent

_parent: Entity

Private _parentNotifierKeys

_parentNotifierKeys: string[]

Private _regionDimension

_regionDimension: Dimension

Private _regionList

_regionList: object

Type declaration

Private _regions

_regions: Entity[][][]

Protected _view

_view: EntityView

Static defaultMaxListeners

defaultMaxListeners: number

Methods

Private _coordinateToRegion

Private _generateRegions

  • _generateRegions(): void
  • private _generateRegions

    Genetates regions of children to make searches more efficient
    

    Returns void

Private _getChildrenInRegion

Private _putChildInRegion

  • _putChildInRegion(child: Entity): void

Private _removeChildFromRegions

  • _removeChildFromRegions(child: Entity): void

Private _setDefaults

  • _setDefaults(): void
  • private _setDefaults

    Sets the default attributes for this entity.
    

    Returns void

Private _setModified

  • _setModified(state: boolean): void
  • private setModified

    Sets whether this Entity has been modified since the last render
    frame.
    

    Parameters

    • state: boolean

    Returns void

Private _updateChildsRegion

  • _updateChildsRegion(child: Entity): void

addChild

  • addChild(child: Entity): void

addListener

  • addListener(event: string | symbol, listener: function): this

childCount

  • childCount(): number
  • public childCount

    Counts the number of child nodes inside this entity.
    

    Returns number

emit

  • emit(event: string | symbol, ...args: any[]): boolean

eventNames

  • eventNames(): Array<string | symbol>

findChildren

findTopChildAt

  • public findTopChildAt

    Tries to find the deepest child at the top most layer at this coordinates. TODO: Update this to support Layers once we have layers...

    Parameters

    Returns Entity | boolean

    Entity

getAbsoluteX

  • getAbsoluteX(): number

getAbsoluteX2

  • getAbsoluteX2(): number

getAbsoluteY

  • getAbsoluteY(): number

getAbsoluteY2

  • getAbsoluteY2(): number

getChildAt

  • getChildAt(index: number): Entity

getChildren

  • public getChildren

    Returns an Iterator of Children.  Can pass
    in a set of coordinates to get children in a specific
    region of coordinates relative to the entity (0,0 is top left of this entity).
    If only the starTCoordinate is specified, looks up children who intersect with that point.
    If both arguements are passed in, looks for children who intersect with the rect the coords create.
    If neither are provided, just returns an iterator of all children.
    

    Not recursive, only checks it's own children

    Parameters

    Returns Iterator<Entity>

    Iterator

getColor

getCoordinate

getHeight

  • getHeight(): number

getID

  • getID(): string

getLocation

getMaxListeners

  • getMaxListeners(): number

getModel

getOuterCoordinate

getParent

getRegionDimension

getRegions

getSize

getTexture

getType

  • getType(): string

getVisible

  • getVisible(): boolean

getWidth

  • getWidth(): number

getX

  • getX(): number

getX2

  • getX2(): number

getY

  • getY(): number

getY2

  • getY2(): number

getZ

  • getZ(): number

indexOf

  • indexOf(child: Entity): number

isChild

  • isChild(child: Entity): boolean
  • public isChild

    Checks to see if the given entity is a child of
    this entity.
    

    Parameters

    Returns boolean

isCollisionable

  • isCollisionable(): boolean

isModified

  • isModified(): boolean
  • public isModified

    Indicates whether this Entity has been modified since the last render frame.
    

    Returns boolean

iterator

  • public iterator DEPRECATED - use getChildren()

    Creates a child node iterator for this entity.
    

    Returns Iterator<Entity>

    { hasNext : function() next : function() hasPrevious : function() previous : function() }

listenerCount

  • listenerCount(type: string | symbol): number

listeners

  • listeners(event: string | symbol): Function[]

on

  • on(event: string | symbol, listener: function): this

once

  • once(event: string | symbol, listener: function): this

prependListener

  • prependListener(event: string | symbol, listener: function): this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this

removeAllChildren

  • removeAllChildren(): void
  • public removeAllChildren

    Removes all child nodes of this entity.
    

    Returns void

removeAllListeners

  • removeAllListeners(event?: string | symbol): this

removeChild

  • removeChild(child: Entity): void

removeListener

  • removeListener(event: string | symbol, listener: function): this

setCollisionable

  • setCollisionable(collisionable: boolean): void

setColor

  • setColor(color: Color): void

setCoordinate

setHeight

  • setHeight(height: number): void

setLocation

  • public setLocation

    Sets the coordinates of this entity. All arguments are optional.
    

    Parameters

    Returns void

setMaxListeners

  • setMaxListeners(n: number): this

setModel

setParent

  • setParent(parent: Entity): void

setSize

setTexture

  • setTexture(asset: Asset): void

setType

  • setType(type: string): void

setVisible

  • setVisible(state: boolean): void

setWidth

  • setWidth(width: number): void

setX

  • setX(x: number): void

setY

  • setY(y: number): void

setZ

  • setZ(z: number): void

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number

Generated using TypeDoc