You have heard about entities for the first time in Chapter 3, Forge of the Gods – Shaping Our World, where we built the
World class and the scene graph. As a quick reminder, the
SceneNode base class was inherited by the
Entity class. Entities are the central part of this chapter. It's all about the interaction between entities of different kinds. Before starting to implement all those interactions, it is reasonable to think about crucial properties our entities need to have.
Since, we are preparing our airplanes for the battlefield, we need to provide them with new specific attributes. To our class definition of
Entity, we add a new member variable that memorizes the current hitpoints. Hitpoints (HP) are a measure for the hull integrity of an entity; the entity is destroyed as soon as the hitpoints reach or fall below zero.
In addition to the member variable, we provide member functions that allow the modification of the hitpoints. We do not provide...