aboutsummaryrefslogtreecommitdiff
path: root/src/Hero.cpp
diff options
context:
space:
mode:
authorSamu Laaksonen <laaksonen.sj@gmail.com>2012-09-25 20:00:41 +0300
committerSamu Laaksonen <laaksonen.sj@gmail.com>2012-09-25 20:00:41 +0300
commit685fe05def77b039221edf06c74af74915d536c5 (patch)
tree9c1a14b8f68bc0f801bdec3edc447d04fdbf7a4c /src/Hero.cpp
parent29eabac0670574efd384182c065f53d08c42a483 (diff)
downloadprism-685fe05def77b039221edf06c74af74915d536c5.tar.gz
prism-685fe05def77b039221edf06c74af74915d536c5.zip
Initial code commit
Added some stuff for project base - tiled sources - few Qt based classes for gfx
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();
+ }
+}