Advertisement
Guest User

health.cpp

a guest
May 27th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include"health.h"
  2. #include "game.h"
  3. #include <QFont>
  4.  
  5. Health::Health(QGraphicsItem *parent): QGraphicsTextItem(parent)
  6. {
  7.     hh = 3;
  8.  
  9.     //draw the text
  10.     setPlainText(("Health: ") + QString::number(hh));
  11.     setDefaultTextColor(Qt::white);
  12.     setFont(QFont("times", 16));
  13.  
  14. }
  15.  
  16. void Health::decrease()
  17. {
  18.     hh--;
  19.     if(hh==0){
  20.         //setFont(QFont("times", 60));
  21.         // setPlainText(("BUAHA U ARE DEAD"));
  22.  
  23.         //Game *game = new Game();//dupa
  24.         game->GameOver();//keke
  25.         return;
  26.     }
  27.     setPlainText(("Health: ") + QString::number(hh));
  28. }
  29.  
  30. int Health::getHealth()
  31. {
  32.     return hh;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement