aboutsummaryrefslogtreecommitdiff
path: root/src/Character.cpp
blob: 83b18cef00e9e826de3970e8f2c304d2ec46ae75 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#include "Character.h"

Character::Character(QGraphicsItem *parent, QGraphicsScene *scene)
    : Sprite(parent, scene),
      m_healthPoints(10),
      m_shieldCapacity(0),
      m_meleeDamage(5),
      m_rangedDamage(0),
      m_velocityX(0),
      m_velocityY(0),
      m_state(STATE_IDLE)
{

}

Character::~Character()
{
}

void Character::increaseHealthPoints(int hp)
{
    m_healthPoints += hp;
}

void Character::decreaseHealthPoints(int hp)
{
    m_healthPoints -= hp;

    if(m_healthPoints <= 0)
    {
        m_state = STATE_DEAD;
    }
}

void Character::setHealthPoints(int hp)
{
    m_healthPoints = hp;
}

int Character::getHealthPoints()
{
    return m_healthPoints;
}

void Character::increaseShieldCapacity(int shieldCapacity)
{
    m_shieldCapacity += shieldCapacity;
}

void Character::decreaseShieldCapacity(int shieldCapacity)
{
    m_shieldCapacity -= shieldCapacity;
}

void Character::setShieldCapacity(int shieldCapacity)
{
    m_shieldCapacity = shieldCapacity;
}

int Character::getShieldCapacity()
{
    return m_shieldCapacity;
}

void Character::setMeleeDamage(int damage)
{
    m_meleeDamage = damage;
}

int Character::getMeleeDamage()
{
    return m_meleeDamage;
}

void Character::setRangedDamage(int damage)
{
    m_rangedDamage = damage;
}

int Character::getRangedDamage()
{
    return m_rangedDamage;
}

void Character::setVelocityX(int x)
{
    m_velocityX = x;
}

void Character::setVelocityY(int y)
{
    m_velocityY = y;
}

int Character::getVelocityX()
{
    return m_velocityX;
}

int Character::getVelocityY()
{
    return m_velocityY;
}

void Character::setState(State s)
{
    m_state = s;
}

State Character::getState()
{
    return m_state;
}