Fix healcounter

This commit is contained in:
Adrian Hedqvist 2017-11-16 20:18:13 +01:00
parent 817da7bd60
commit 1809dafb73
2 changed files with 4 additions and 3 deletions

View file

@ -21,11 +21,11 @@ void Actor::update() {
bt->tick(this);
}
if (health < health_max) {
healcounter--;
if (healcounter <= 0) {
health++;
heal(1);
healcounter = 4;
}
healcounter--;
}
if (health <= 0) {
kill();

View file

@ -31,11 +31,12 @@ protected:
float range;
bool alive;
ActorFactions faction;
Actor(Tilemap *map, vec2i pos);
public:
int id;
std::string name;
Actor(Tilemap *map, vec2i pos);
Actor(Tilemap *map, vec2i pos, std::string datakey);
bool is_alive(){ return alive; };
void attack(vec2i dpos); // basic melee attack
void attack(Actor* act);