Options
All
  • Public
  • Public/Protected
  • All
Menu

A 2D vector data class containing an x and a y coordinate. Example usages: Position of the player, the enemy, or a wall.

Hierarchy

  • Vec2D

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • new Vec2D(x?: number, y?: number): Vec2D

Properties

x

x: number = 0

y

y: number = 0

Accessors

getNormalized

  • get getNormalized(): Vec2D

Methods

floor

  • floor(): void
  • Round down to integer (throw away decimals) Used in maps to "go" to the origin of the map tile/element

    Returns void

getDifference

  • Parameters

    • minuend: Vec2D

      The vector which we use to subtract from (this)

    Returns Vec2D

    Subtrahend: Copy of difference of vectors

toString

  • toString(): string
  • To String method

    Returns string

    string with x and y elements

Generated using TypeDoc