aboutsummaryrefslogtreecommitdiff
path: root/src/Hero.cpp
blob: 5af9b6afe903fcabcbc0b873c063e84ae974b19d (plain)
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
40
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();
    }
}