-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenemy.cpp
More file actions
61 lines (50 loc) · 832 Bytes
/
Copy pathenemy.cpp
File metadata and controls
61 lines (50 loc) · 832 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
56
57
58
59
60
61
#include "enemy.h"
#include "bullet.h"
#include <iostream>
///*** Constructor and Destructor ***///
Enemy::Enemy(int x, int y)
{
frameCount = 1;
attacking = false;
location.setX(x);
location.setY(y);
//hitBox.setRect(0,0,30,30);
}
Enemy::~Enemy()
{
}
///*** Member Functions***///
void Enemy::move(int x, int y)
{
location.setX(x);
location.setY(y);
QPoint point(location.x()-1,location.y()-1);
hitBox.moveCenter(point);
attackFrame.rect().moveTo(location);
}
void Enemy::takeDamage(int dmg)
{
health-=dmg;
}
///*** Getters ***///
int Enemy::getHealth()
{
return health;
}
bool Enemy::getAttacking()
{
return attacking;
}
QPoint Enemy::getLocation()
{
return location;
}
QImage & Enemy::getAttackFrame()
{
return attackFrame;
}
///*** Setters ***///
void Enemy::setAttacking(bool a)
{
attacking = a;
}