Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Enemy

An enemy game object.

Hierarchy

Index

Constructors

constructor

Properties

currentPos

currentPos: Point

The current position of the entity.

dead

dead: boolean

Whether or not this entity is dead.

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.

properties

properties: GameObject

The properties of this enemy as described by the Objects resource.

tickPos

tickPos: Point

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

Methods

damage

  • damage(damage: number, armorPiercing?: boolean): number
  • Calculates the amount of damage a bullet will apply to an enemy.

    Parameters

    • damage: number

      The amount of damage to apply.

    • Default value armorPiercing: boolean = false

      Whether or not the damage is armor piercing.

    Returns number

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

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

Generated using TypeDoc