-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhealth.cpp
39 lines (33 loc) · 822 Bytes
/
health.cpp
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
#include "health.h"
#include "gamewindow.h"
/** Default constructor. Creates a Health indicator with the specified parameters.
* @param pixmap The Pixmap to display this object with
* @param parent The GameWindow which created this object
* @param scene The scene in which this object exists
*/
Health::Health(QPixmap & pixmap, GameWindow * parent, QGraphicsScene *scene) : Thing(pixmap, 0, 0)
{
offscreen = false;
scene_ = scene;
parent_ = parent;
vy_ = 0;
vx_ = 0;
x_ = 20;
y_ = 530;
setPos(x_, y_);
setZValue(10);
}
/** Destructor */
Health::~Health()
{
}
/**Sets the position of this object based on how many health indicators there already are */
void Health::setNum(int num)
{
x_ += 29*num;
setPos(x_, y_);
}
/**Unused move function */
void Health::move()
{
}