-
Notifications
You must be signed in to change notification settings - Fork 0
/
unit.h
80 lines (57 loc) · 1.66 KB
/
unit.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef UNIT_H_INCLUDED
#define UNIT_H_INCLUDED
#include <SFML/Graphics.hpp>
#include <iostream>
#include <list>
#include "animation.h"
#include "Animated.hpp"
#include "image_manager.h"
#include "const.h"
#include "timer.h"
//class mère des unités de jeu (player, enemy)
class Unit
{
public:
Unit(int life, int xSpeed, int ySpeed, sf::Vector2f position);
//Destructeur
~Unit();
//Accesseur sur les hp restants
short getLife();
//Reçoit des dommages
void recieveDamages(int dmg);
//Définit s'i lest mort ou non
virtual bool isDead();
//Dessine l'explosion
void drawExplosion();
//Accsseur sur la taille de l'explosion
int getExploWidth();
int getExploHeight();
//Accesseur sur la vitesse
sf::Vector2f getSpeed();
//Accesseur sur le coeficient de vitesse
short getCoefSpeed() const;
protected:
//Variables d'animation
Anim m_animExplosion;
Animated *m_animatedExplosion;
//La position courante
sf::Vector2f m_position;
//Echelle d'affichage
const sf::Vector2f m_scale;
//Taille de l'explosion
int EXPLOS_WIDTH, EXPLOS_HEIGHT;
//Le sprite
sf::Sprite sprite;
//L'image de l'explosion
sf::Image *imageExplosion;
//Les hp qui restent
int m_life;
// Vitesses sur chaque axe
short m_xSpeed, m_ySpeed;
//Le coeficient de vitesse
short coefSpeed;
//Le frame courant
short currentFrameX, currentFrameY;
Timer animExplosion;
};
#endif // UNIT_H_INCLUDED