-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzombie.cpp
More file actions
55 lines (45 loc) · 919 Bytes
/
zombie.cpp
File metadata and controls
55 lines (45 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "zombie.h"
#include <QDebug>
int Zombie::zombiesAlive = 0;
bool Zombie::zombiesWin = false;
Zombie::Zombie()
{
//Intially all zombies are not slowed and are not attacking
isSlowed = false;
isAttacking = false;
//Adds one to number of zombies alive
zombiesAlive++;
}
Zombie::~Zombie()
{
--zombiesAlive;
qDebug() << zombiesAlive;
}
void Zombie::decreaseLife(int value)
{
//Drecreases life of zombie, first the equipment then zombie
equipmentLife -= value;
if(equipmentLife <= 0)
{
zombieLife += equipmentLife;
equipmentLife = 0;
}
}
void Zombie::setSlowEffect()
{
//decreases the velocity by 50%
this->isSlowed = true;
xVelocity *= 0.5;
}
bool Zombie::getSlowStatus() const
{
return isSlowed;
}
void Zombie::attack(Plant *item)
{
//Decreases the hp of plant
item->decreaseHealth(damage);
}
void Zombie::move()
{
}