#include "Vector2d.h" namespace game { Vector2d::Vector2d(const int x, const int y) { this->x = x; this->y = y; } void Vector2d::update(const int& x, const int& y) { this->x = x; this->y = y; } void Vector2d::change_x(const int& amount) { this->x += amount; } void Vector2d::change_y(const int& amount) { this->y += amount; } Vector2d Vector2d::normalize() { Vector2d v = *this; if (v.x < 0) v.x *= -1; if (v.y < 0) v.y *= -1; return v; } bool Vector2d::eq(const Vector2d& position) const { return this->x == position.x && this->y == position.y; } Vector2d Vector2d::get_new_updated(const int& diff_x, const int& diff_y) const { Vector2d new_position = *this; new_position.change_x(diff_x); new_position.change_y(diff_y); return new_position; } } // game