Using entities to build characters

So far, we only have entities that define some abstract methods and provide the means of manipulating them, but nothing that can appear in the game world, be rendered, and walk around. At the same time, we don't want to re-implement all of that functionality all over again in the player or enemy classes, which means we need an intermediate-level abstract class: Character. This class will provide all of the functionality that is shared between all entities that need to move around the world and be rendered. Let's get on with designing:

class Character : public EntityBase{ friend class EntityManager; public: Character(EntityManager* l_entityMgr); virtual ~Character(); void Move(const Direction& l_dir); void Jump(); ...

Get SFML Game Development By Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.