Tower Defence 2
Public Member Functions | Protected Attributes | List of all members
Object Class Reference

#include <object.h>

Inheritance diagram for Object:
Inheritance graph
[legend]

Public Member Functions

 Object (double x, double y, double radius, double speed, int health, int damage, double attack_range, double attack_speed)
 
double x () const
 
double y () const
 
double radius () const
 
double speed () const
 
double distance_travelled () const
 
int health () const
 
int max_health () const
 
int damage () const
 
double attack_speed () const
 
double attack_range () const
 
TargetingPolicy targeting_policy () const
 
double time_since_last_attack () const
 
void position (double x, double y)
 
void speed (double amount)
 Change the speed of the object between zero and maximum speed.
 
bool is_dead ()
 Object is regarded dead if it has health below of equal to zero.
 
void health (int amount)
 
void damage (int new_dmg)
 Change damage.
 
void attack_speed (int new_speed)
 Change attack speed.
 
void change_policy (TargetingPolicy new_policy)
 Change target policy.
 
void distace_travelled (double d)
 Change distace travelled.
 
double distance (Object &other)
 Distance from other object.
 
bool attack (Object &other, double timestep)
 Attack to another object. Takes account the attack speed of the object.
 

Protected Attributes

double m_x
 x coordinate of the object
 
double m_y
 u coordinate of the object
 
const double m_radius
 Physical radius of the object.
 
double m_speed
 Current speed of the object.
 
const double m_max_speed
 Maximum speed of the object.
 
double m_distance_travelled
 Distance travelled by object.
 
int m_health
 Current health of the object.
 
const int m_max_health
 Maximum health of the object.
 
int m_damage
 Amount of damage each hit deals.
 
double m_attack_speed
 Attack speed, how fast does the object deal damage.
 
double m_attack_range
 Attack range, how far can the object deal damage.
 
TargetingPolicy m_targeting_policy
 Targeting policy, how will the object choose its target.
 
double m_time_since_last_attack
 Time since last time tower attacked. Used for attack speed.
 

Detailed Description

Base class for objects in tower defence. Contains position, speed and the movement of the object. Both tower and enemies inherit from this class.

Member Function Documentation

void Object::health ( int  amount)

Negative damages, positive heals, if reached zero, enemy dies, cannot go above max health


The documentation for this class was generated from the following files: