-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHeart.cpp
39 lines (34 loc) · 1.09 KB
/
Heart.cpp
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
#include "Heart.hpp"
namespace ArktisProductions
{
Heart::Heart(GameDataRef data) :_data(data)
{
for (short unsigned int i=0; i < 3; i++ )
{
this->heartSprites.push_back(sf::Sprite(this->_data->assets.GetTexture("heart")));
this->heartSprites.at(i).setPosition(i*heartSprites.at(i).getGlobalBounds().width + 10, 10);
}
}
void Heart::DrawHearts()
{
for (short unsigned int i=0; i < this->heartSprites.size(); i++)
this->_data->window.draw(heartSprites.at(i));
}
void Heart::ReceiveDMG()
{
this->heartSprites.pop_back();
}
void Heart::RestartHearts()
{
// THIS IS ONLY TO BE CALLED WHEN THE PERSON DIES
for(int i=0; i < 3; i++)
{
this->heartSprites.push_back(sf::Sprite(this->_data->assets.GetTexture("heart")));
this->heartSprites.at(i).setPosition(i*heartSprites.at(i).getGlobalBounds().width + 10, 10);
}
}
const unsigned short int Heart::GetHealth() const
{
return this->heartSprites.size();
}
}