Defines an axis aligned rectangle positioned in 2D space.
Immutable 2D Vector.
Immutable 2D Vector.
There are two ways to create vectors: Vector2(x, y)
will create a vector with components x and y and
Vector2(a)
will create a unit vector rotated by an angle of a
radians.
(In the JavaScript version, create vectors using Game.vector2(x, y)
.)
Addition, subtraction, multiplication and division work as expected:
>> 2 * Vector2(0.5, 0) + Vector2(0, 10) / 10 - Vector2(10, 0) res0: Vector2 = Vector2(-9, 1)
If you are using Java, you can use the methods plus
, times
and minus
in place of the symbolic operators.
The x coordinate.
The y coordinate.
Defines an axis aligned rectangle positioned in 2D space.
The x coordinate for the left side of the rectangle.
The x coordinate for the right hand side of the rectangle.
The y coordinate of the bottom side of the rectangle.
The y coordinate of the top side of the rectangle.