Fix healcounter
This commit is contained in:
parent
817da7bd60
commit
1809dafb73
2 changed files with 4 additions and 3 deletions
|
@ -21,11 +21,11 @@ void Actor::update() {
|
||||||
bt->tick(this);
|
bt->tick(this);
|
||||||
}
|
}
|
||||||
if (health < health_max) {
|
if (health < health_max) {
|
||||||
|
healcounter--;
|
||||||
if (healcounter <= 0) {
|
if (healcounter <= 0) {
|
||||||
health++;
|
heal(1);
|
||||||
healcounter = 4;
|
healcounter = 4;
|
||||||
}
|
}
|
||||||
healcounter--;
|
|
||||||
}
|
}
|
||||||
if (health <= 0) {
|
if (health <= 0) {
|
||||||
kill();
|
kill();
|
||||||
|
|
|
@ -31,11 +31,12 @@ protected:
|
||||||
float range;
|
float range;
|
||||||
bool alive;
|
bool alive;
|
||||||
ActorFactions faction;
|
ActorFactions faction;
|
||||||
|
Actor(Tilemap *map, vec2i pos);
|
||||||
public:
|
public:
|
||||||
int id;
|
int id;
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
Actor(Tilemap *map, vec2i pos);
|
Actor(Tilemap *map, vec2i pos, std::string datakey);
|
||||||
bool is_alive(){ return alive; };
|
bool is_alive(){ return alive; };
|
||||||
void attack(vec2i dpos); // basic melee attack
|
void attack(vec2i dpos); // basic melee attack
|
||||||
void attack(Actor* act);
|
void attack(Actor* act);
|
||||||
|
|
Loading…
Add table
Reference in a new issue