28 lines
441 B
JavaScript
28 lines
441 B
JavaScript
GameLib.D3.Vector2 = function(x, y) {
|
|
|
|
this.x = 0;
|
|
this.y = 0;
|
|
|
|
if (x) {
|
|
this.x = x;
|
|
}
|
|
|
|
if (y) {
|
|
this.y = y;
|
|
}
|
|
};
|
|
|
|
GameLib.D3.Vector2.prototype.copy = function() {
|
|
return new GameLib.D3.Vector2(
|
|
this.x,
|
|
this.y
|
|
);
|
|
};
|
|
|
|
GameLib.D3.Vector2.prototype.equals = function(v) {
|
|
return !!(((this.x == v.x) &&
|
|
(this.y == v.y)) ||
|
|
((this.y == v.x) &&
|
|
(this.x == v.y)));
|
|
};
|