aboutsummaryrefslogtreecommitdiff
path: root/src/Hero.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Hero.cpp')
-rw-r--r--src/Hero.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/Hero.cpp b/src/Hero.cpp
new file mode 100644
index 0000000..5af9b6a
--- /dev/null
+++ b/src/Hero.cpp
@@ -0,0 +1,41 @@
+#include <QApplication>
+#include <QGraphicsScene>
+#include <QGraphicsPixmapItem>
+#include <QSettings>
+#include <QDebug>
+
+#include "Hero.h"
+#include "GameScene.h"
+
+Hero::Hero(QGraphicsScene* scene, QPointF pos, QGraphicsItem* parent)
+ : Character(parent, scene)
+{
+ m_state = STATE_IDLE;
+
+ // something small for testing purposes
+ setHealthPoints(15);
+
+ setPos(pos);
+ setZValue(2);
+
+ setShapeMode(QGraphicsPixmapItem::MaskShape);
+}
+
+Hero::~Hero()
+{
+}
+
+void Hero::advance(int phase)
+{
+ Character::advance(phase);
+
+ if (phase == 0)
+ return;
+
+ // err, no good.
+ if(m_state == STATE_DEAD)
+ {
+ gameOver();
+ //removeMe();
+ }
+}