-
Notifications
You must be signed in to change notification settings - Fork 0
/
Enemy.h
49 lines (38 loc) · 925 Bytes
/
Enemy.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
#ifndef ENEMY_H
#define ENEMY_H
#include <SFML/Graphics.hpp>
#include "utils.h"
class Enemy
{
private:
int hp;
int hpMax;
int type;
int damage;
int points;
int state;
//sf::CircleShape shape;
sf::Texture texture;
sf::Sprite sprite;
sf::IntRect currentFrame;
sf::Clock animationTimer;
void initVariables();
//void initShape();
void initTexture();
void initSprite();
public:
Enemy(float pos_x, float pos_y, int type);
virtual ~Enemy();
// accessors
sf::FloatRect getBounds();
int getState() { return this->state; }
void setState(State state) { this->state = state; }
void rotate(float angle) { this->sprite.setRotation(angle); }
void updateFlyAnimation();
void updateExplosionAnimation();
void updateAttackAnimation();
void updateSpinningAnimation();
void update();
void render(sf::RenderTarget& target);
};
#endif // !ENEMY_H