Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Entity

An entity which exists in the game.

Hierarchy

Index

Constructors

constructor

  • new Entity(status: ObjectStatusData): Entity

Properties

currentPos

currentPos: Point

The current position of the entity.

dead

dead: boolean

Whether or not this entity is dead.

Private deadCounter

deadCounter: number

lastTickId

lastTickId: number

The tick id of the last game tick received by this entity.

lastUpdate

lastUpdate: number

The client time of the last update that this entity received.

moveVector

moveVector: Point

The velocity of the entity.

objectData

objectData: PlayerData

Stat information of the entity, such as HP and defense.

posAtTick

posAtTick: Point

The position of the entity at a particular game tick.

tickPos

tickPos: Point

The position of the entity as received in a NewTick packet.

Methods

frameTick

  • frameTick(lastTick: number, clientTime: number): void
  • Updates this entities state based on the current frame.

    Parameters

    • lastTick: number

      The last tick id.

    • clientTime: number

      The current client time.

    Returns void

Private moveTo

  • moveTo(x: number, y: number): void

onGoto

  • onGoto(x: number, y: number, time: number): void
  • Updates this entity based on a goto packet.

    Parameters

    • x: number

      The X position to go to.

    • y: number

      The Y position to go to.

    • time: number

      The client time.

    Returns void

onNewTick

  • onNewTick(objectStatus: ObjectStatusData, tickTime: number, tickId: number, clientTime: number): void
  • Updates the entity based on the tick info.

    Parameters

    • objectStatus: ObjectStatusData

      The object status of this entity.

    • tickTime: number

      The time of this tick.

    • tickId: number

      The tick id of this tick.

    • clientTime: number

      The client time of this tick.

    Returns void

squareDistanceTo

  • squareDistanceTo<T>(point: T): number
  • The square distance from some point to this entity.

    Type parameters

    • T: Point

    Parameters

    • point: T

    Returns number

Generated using TypeDoc