API Docs for: 1.13.1
Show:

game.Vector Class

Extends game.Class
Defined in: engine/physics.js:468
Module: physics

Vector class.

Constructor

game.Vector

(
  • [x]
  • [y]
)

Parameters:

  • [x] Number optional
  • [y] Number optional

Methods

add

(
  • x
  • [y]
)
game.Vector

Add to vector values.

Parameters:

Returns:

angle

(
  • vector
)
Number

Get angle between two vectors.

Parameters:

Returns:

Number:

angleFromOrigin

(
  • vector
)
Number

Get angle between two vectors from origin.

Parameters:

Returns:

Number:

clone

() game.Vector

Clone vector.

Returns:

copy

(
  • v
)
game.Vector

Copy values from another vector.

Parameters:

Returns:

distance

(
  • vector
)
Number

Get distance of two vectors.

Parameters:

Returns:

Number:

divide

(
  • x
  • [y]
)
game.Vector

Divide vector values.

Parameters:

Returns:

dot

(
  • [vector]
)
Number

Get dot of vector.

Parameters:

Returns:

Number:

dotNormalized

(
  • [vector]
)
Number

Get normalized dot of vector.

Parameters:

Returns:

Number:

extend

(
  • prop
)
game.Class

Inherited from game.Class: engine/core.js:757

Extend class.

Parameters:

  • prop Object

Returns:

init

(
  • arguments
)

Inherited from game.Class: engine/core.js:811

This method is called, when you create new instance of the class.

Parameters:

  • arguments Array

inject

(
  • prop
)

Inherited from game.Class: engine/core.js:825

Inject class.

Parameters:

  • prop Object

length

() Number

Get length of vector.

Returns:

Number:

limit

(
  • vector
)
game.Vector

Limit vector values.

Parameters:

Returns:

multiply

(
  • x
  • [y]
)
game.Vector

Multiply vector values.

Parameters:

Returns:

multiplyAdd

(
  • x
  • [y]
)
game.Vector

Multiply and add vector values.

Parameters:

Returns:

normalize

() game.Vector

Normalize vector.

Returns:

rotate

(
  • angle
)
game.Vector

Rotate vector in radians.

Parameters:

  • angle Number

Returns:

round

() game.Vector

Round vector values.

Returns:

set

(
  • x
  • y
)
game.Vector

Set vector values.

Parameters:

  • x Number
  • y Number

Returns:

staticInit

(
  • arguments
)

Inherited from game.Class: engine/core.js:795

This method is called before init.

Parameters:

  • arguments Array

subtract

(
  • x
  • [y]
)
game.Vector

Subtract from vector values.

Parameters:

Returns: