-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcharacter.h
60 lines (49 loc) · 1.45 KB
/
character.h
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
#ifndef CHARACTER_H
#define CHARACTER_H
#include <move.h>
#include <animation.h>
#include <hitbox.h>
class Character:public sf::Sprite
{
public:
Character();
virtual ~Character();
void setTexture(sf::Texture& texture);
void createHitbox(sf::Sprite& sprite,sf::FloatRect position,int which=1);
void createMove(const float speed);
void createAnimation(sf::Texture& textureSheet);
void setRow(unsigned int row);
unsigned int getRow();
virtual void setPosition(const sf::Vector2f position);
virtual const sf::Vector2f &getPosition() const;
virtual void move(const sf::Vector2f direction,const float &deltaTime);
virtual bool getAtck()=0;
virtual bool getAttacking()=0;
virtual void setDie(bool die);
virtual bool getDie();
virtual void loseHP(const int hp, const float deltaTime)=0;
virtual void gainHP(const int hp)=0;
virtual float getDistance(const Character& character) const;
virtual const sf::Vector2f getCenter() const;
virtual void update(const float& deltaTime);
virtual void render(sf::RenderWindow& window);
Hitbox* hitbox;
Hitbox* hitboxAttack;
int hp;
int hpMax;
int attackDmg;
int exp;
int range;
protected:
sf::Sprite sprite;
Move* movement;
std::vector<Animation> animation;
unsigned int row;
int characterType;
bool isDied;
bool isAttacking;
bool attack=false;
private:
void initVariables();
};
#endif // CHARACTER_H