You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
439 B
23 lines
439 B
2 years ago
|
#include "health.h"
|
||
|
#include <QFont>
|
||
|
#include <QGraphicsTextItem>
|
||
|
|
||
|
|
||
|
Health::Health(QGraphicsItem *parent): QGraphicsTextItem(parent){
|
||
|
health = 3;
|
||
|
|
||
|
setPlainText(QString("Health: ") + QString::number(health));
|
||
|
setDefaultTextColor(Qt::red);
|
||
|
setFont(QFont("times",16));
|
||
|
}
|
||
|
|
||
|
void Health::decrease(){
|
||
|
health--;
|
||
|
setPlainText(QString("Health: ") + QString::number(health));
|
||
|
}
|
||
|
|
||
|
int Health::getHealth(){
|
||
|
return health;
|
||
|
}
|
||
|
|