December 2015
Beginner to intermediate
522 pages
11h 21m
English
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 ...
Read now
Unlock full access