1 #ifndef TOWER_DEFENCE_2_OBJECT_H 2 #define TOWER_DEFENCE_2_OBJECT_H 11 enum TargetingPolicy {
21 Object(
double x,
double y,
double radius,
double speed,
int health,
22 int damage,
double attack_range,
double attack_speed);
28 double radius()
const;
30 double distance_travelled()
const;
32 int max_health()
const;
34 double attack_speed()
const;
35 double attack_range()
const;
36 TargetingPolicy targeting_policy()
const;
37 double time_since_last_attack()
const;
39 void position(
double x,
double y);
42 void speed(
double amount);
49 void health(
int amount);
52 void damage(
int new_dmg);
55 void attack_speed(
int new_speed);
99 #endif //TOWER_DEFENCE_2_OBJECT_H
int m_health
Current health of the object.
Definition: object.h:83
double m_x
x coordinate of the object
Definition: object.h:71
double distance(Object &other)
Distance from other object.
Definition: object.cpp:115
double m_distance_travelled
Distance travelled by object.
Definition: object.h:81
const int m_max_health
Maximum health of the object.
Definition: object.h:85
double m_time_since_last_attack
Time since last time tower attacked. Used for attack speed.
Definition: object.h:95
double m_y
u coordinate of the object
Definition: object.h:73
bool attack(Object &other, double timestep)
Attack to another object. Takes account the attack speed of the object.
Definition: object.cpp:119
int m_damage
Amount of damage each hit deals.
Definition: object.h:87
bool is_dead()
Object is regarded dead if it has health below of equal to zero.
Definition: object.cpp:78
const double m_max_speed
Maximum speed of the object.
Definition: object.h:79
double m_attack_speed
Attack speed, how fast does the object deal damage.
Definition: object.h:89
double m_attack_range
Attack range, how far can the object deal damage.
Definition: object.h:91
const double m_radius
Physical radius of the object.
Definition: object.h:75
void change_policy(TargetingPolicy new_policy)
Change target policy.
Definition: object.cpp:74
double m_speed
Current speed of the object.
Definition: object.h:77
void distace_travelled(double d)
Change distace travelled.
Definition: object.cpp:111
TargetingPolicy m_targeting_policy
Targeting policy, how will the object choose its target.
Definition: object.h:93