Handling collisions
Making entities bump into each other, as well as into all the lush environments we'll be building is a mechanic, without which most games out there would not be able to function. In order for that to be possible, these animated images zooming around the screen must have a component, which represents their solidity. Bounding boxes worked really well for us in the past, so let's stick to them and begin constructing the collidable body component:
enum class Origin{ Top_Left, Abs_Centre, Mid_Bottom };
class C_Collidable : public C_Base{
public:
...
private:
sf::FloatRect m_AABB;
sf::Vector2f m_offset;
Origin m_origin;
bool m_collidingOnX;
bool m_collidingOnY;
};Every collidable entity must have a bounding box that represents the solid portion of it. That's exactly where the m_AABB rectangle comes in. In addition to that, the bounding box itself can be offset by a number of pixels, based on what kind of entity it is, as well as have a different origin...