Skip to content

Vector2

Joshua Murphy edited this page Jul 17, 2016 · 8 revisions

A 2D vector object that holds an x component and a y component. It's primarily used to keep track of a GameObject's position, velocity, and acceleration.

Constructors Descriptions
Vector2.new( x , y ) Calling this function will return a new vector with the given coordinates.
Properties Descriptions
x The x component.
y The y component.
Operations Descriptions
v == u Results in true if v.x == u.x and v.y == u.y
v + u Results in Vector2.new( v.x + u.x , v.y + u.y )
v - u Results in Vector2.new( v.x - u.x , v.y - u.y )
v * a Results in Vector2.new( v.x * a , v.y * a )
v / a Results in Vector2.new( v.x / a , v.y / a )
-v Results in Vector2.new( -v.x, -v.y )

Clone this wiki locally