Example #1
0
bool operator==(const Vector2d& a, const Vector2d& b) {
    //Implement Here.
    if (a.get_x() == b.get_x() && a.get_y() == b.get_y())
        return true;
    else
        return false;

}
bool Game_Object::intersects_point(Vector2d& point)
{
	if (point.get_x() > position.get_x() - width / 2.0
		&& point.get_x() < position.get_x() + width / 2.0
		&& point.get_y() > position.get_y() - height / 2.0
		&& point.get_y() < position.get_y() + height / 2.0
	   )
	{
		return true;
	}

	return false;
}
Example #3
0
// operator overloading of '=='
bool operator==(const Vector2d& a, const Vector2d& b) {
    return (a.get_x()==b.get_x() && a.get_y()==b.get_y());
}
Example #4
0
bool operator>(const Vector2d& a, const Vector2d& b){
    return a.get_y() > b.get_y();
}
Example #5
0
Vector2d operator-(const Vector2d& a, const Vector2d& b) {
    //return subtract(a, b);
    return Vector2d((a.get_x() - b.get_x()), (a.get_y() - b.get_y()));
}
Example #6
0
Vector2d subtract(const Vector2d& a, const Vector2d& b) {
    //Implement Here.
    return Vector2d((a.get_x() - b.get_x()), (a.get_y() - b.get_y()));

}
Example #7
0
Vector2d add(const Vector2d& a, const Vector2d& b) { //const indicates that parameters that are const cannot be changed
    //Implement Here.
    return Vector2d((a.get_x() + b.get_x()), (a.get_y() + b.get_y()));
}