Arch Game Engine  0.2
entity.h
1 #ifndef ENTITY_H
2 #define ENTITY_H
3 
4 #include "object.h"
5 #include "collision.h"
6 //#include "inventory.h" //not yet created
7 
9 class Entity : public Object {
10 private:
11  double health;
12  double maxHealth;
13  //Inventory inv; //!< Not yet created. Is going to be an instance of an Inventory class that need to be made.
14  int emotion;
15  int team;
16  bool active;
17  Collision col;
18  SDL_Rect detect;
19 public:
20  Entity();
21  ~Entity();
23  double getHealth() const { return health; }
25  void setHealth(double h) { health=h; }
27  double getMaxHealth() const { return maxHealth; }
29  void setMaxHealth(double mh) { maxHealth=mh; }
31  void damage(double d);
33  void heal(double h);
35  int getEmotion() const { return emotion; }
37  void setEmotion(int e) { emotion=e; }
39  int getTeam() const { return team; }
41  void setTeam(int t) { team=t; }
43  bool isActive() const { return active; }
45  void kill();
47  void deactivate();
49  void activate();
51  void checkDisplayable(Object screen);
53  SDL_Rect getDetect() const { return detect; }
55  void setDetect(SDL_Rect d) { detect = d; }
57  void setDetectRange(int r);
59  void setDetectRange(int w, int h);
60 };
61 
62 #endif //ENTITY_H
This class stores information for an Object in the game.
Definition: object.h:12
void deactivate()
Sets active to false.
Definition: entity.cpp:25
int getEmotion() const
Get current emotion state.
Definition: entity.h:35
void checkDisplayable(Object screen)
Checks if an the Entity is in the current screen by passing the screen to it.
Definition: entity.cpp:32
void setEmotion(int e)
Set current emotion state.
Definition: entity.h:37
SDL_Rect getDetect() const
Returns the detection radius.
Definition: entity.h:53
double getMaxHealth() const
Get max health.
Definition: entity.h:27
void setHealth(double h)
Set the Entity&#39;s health. If the health is higher then the max health it will set it to the max health...
Definition: entity.h:25
void setMaxHealth(double mh)
Set max health.
Definition: entity.h:29
void activate()
Sets active to true.
Definition: entity.cpp:28
int getTeam() const
Get Entity&#39;s team.
Definition: entity.h:39
void setDetect(SDL_Rect d)
Sets the detection with another SDL_Rect.
Definition: entity.h:55
Class for storing health, emotion, team, etc. of an Object.
Definition: entity.h:9
void setDetectRange(int r)
Sets the detection radius with a single given distance.
Definition: entity.cpp:42
void heal(double h)
Give health to the Entity.
Definition: entity.cpp:14
void setTeam(int t)
Set Entity&#39;s team.
Definition: entity.h:41
Class used for calculating different types of collision between given Objects.
Definition: collision.h:7
double getHealth() const
Get Entity&#39;s health.
Definition: entity.h:23
bool isActive() const
Check if Entity is active.
Definition: entity.h:43
void damage(double d)
Deal damage. Subtracted from health. If health is less then zero it kills the entity.
Definition: entity.cpp:7
void kill()
Sets health to zero and deactives the Entity.
Definition: entity.cpp:20