🌟 Introduction
The Mothership Calls is a 2D local multiplayer asteroid game developed as a one-week school project. The purpose was to create a small game in groups of three using only C++ and SFML. We decided to make small game where two player save a planet from incoming asteroids when both players press on their "shoot" key at the same time they create a beam that destroy any asteroid in the way appear between them. Their are two types of steroids ones that folow the closest player and one that go toward the planet. Each players have two lives.

👾 Gameplay Architecture
In this project I made the collision systems with two types of collision : Line to sphere and sphere to sphere. and we had to write a full uml for the project
SphereCollider.cpp
SphereCollider::SphereCollider(sf::Vector2f& pos, float rad)
{
position = &pos;
radius = rad;
}
bool SphereCollider::CheckCollision(SphereCollider collider)
{
return sqrtf(powf(collider.position->x - position->x, 2.0f) + powf(collider.position->y - position->y, 2.0f)) <= collider.radius + radius;
}
bool SphereCollider::CheckCollision(sf::Vector2f point)
{
return sqrtf(powf(point.x - position->x, 2.0f) + powf(point.y - position->y, 2.0f)) <= radius;
}
bool SphereCollider::CheckCollision(LineCollider collider)
{
if (CheckCollision(*collider.a) || CheckCollision(*collider.b))
{
return true;
}
else
{
float lineLength = sqrtf(powf(collider.a->x - collider.b->x, 2.0f) + powf(collider.a->y - collider.b->y, 2.0f));
float dot = (((position->x - collider.a->x) * (collider.b->x - collider.a->x)) + ((position->y - collider.a->y) * (collider.b->y - collider.a->y)) ) / pow(lineLength, 2);
sf::Vector2f closest = sf::Vector2f(collider.a->x + (dot * (collider.b->x - collider.a->x)), collider.a->y + (dot * (collider.b->y - collider.a->y)));
if (!CheckCollision(closest))
{
return false;
}
else if(sqrtf(powf(collider.a->x - closest.x, 2.0f) + powf(collider.a->y - closest.y, 2.0f)) + sqrtf(powf(collider.b->x - closest.x, 2.0f) + powf(collider.b->y - closest.y, 2.0f)) == sqrtf(powf(collider.a->x - collider.b->x, 2.0f) + powf(collider.a->y - collider.b->y, 2.0f)))
{
return true;
}
}
}
We also had to write a full uml for the project :

.