123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- //
- // Created by jovian on 18/07/17.
- //
- #ifndef TINYSHOOTER_ENTITY_H
- #define TINYSHOOTER_ENTITY_H
- #include <box2d/box2d.h>
- #include <vector>
- #include "../Graphics/Visual.h"
- enum Faction {WALL, BULLET, ALLY, FOE};
- /* class Entity :
- * Store interactive data of a game object.
- */
- class Entity {
- /// Methods :
- public :
- Entity(Faction faction, unsigned int imgId, b2World* physics);
- virtual ~Entity();
- virtual void update() = 0; // Update physical and game entity
- virtual Visual* makeVisual(); // Generate graphical description
- bool isExist() const;
- bool isTouching() const;
- b2Vec2 getPos() const;
- Faction getFaction() const;
- void setExistence(bool exist);
- protected:
- void establishPhysicalLink(); // Put entity data in body's user-data
- /// Variables :
- protected:
- Faction m_faction; // Allows identification in TinyWorld
- bool m_exist; // Entity is destroyed if set to false
- b2World* m_physics; // Link to physic world
- b2Body* m_body; // Link to physic world
- unsigned int m_imgId; // Current picture id
- };
- #endif //TINYSHOOTER_ENTITY_H
|