-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenemy.h
74 lines (54 loc) · 1.42 KB
/
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
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
#ifndef ENEMY__H
#define ENEMY__H
#include <string>
#include <vector>
#include <list>
#include "drawable.h"
#include "globManager.h"
class Enemy : public Drawable {
public:
Enemy(const std::string&, const Vector2f, int, int);
Enemy(const Enemy&);
virtual void draw() const;
virtual void update(Uint32 ticks);
virtual const Image* getImage() const;
int getScaledWidth() const;
int getScaledHeight() const;
virtual const SDL_Surface* getSurface() const;
void setPlayerPosition(const Vector2f& pos) { playerPosition = pos; }
bool inTerritory(const Drawable *) const;
void calm();
void getAngry();
int getFreeGlobs() const { return globs.freeCount(); }
int getUsedGlobs() const { return globs.globCount(); }
void reset();
std::list<Glob *>& getGlobs() { return globs.getGlobs(); }
private:
std::string name;
enum MODE {NORMAL, ANGRY};
enum DIRECTION {LEFT, RIGHT};
MODE currentMode;
DIRECTION currentDirection;
std::vector<Image *> imagesLeft;
std::vector<Image *> imagesRight;
std::vector<Image *> imagesAngry;
unsigned frameNumLeft;
unsigned frameNumRight;
unsigned frameNumAngry;
unsigned currentFrame;
unsigned frameInterval;
Vector2f playerPosition;
int playerWidth;
int playerHeight;
float territoryRadius;
Vector2f territoryOrigin;
Vector2f velocityNormal;
float timeSinceLastFrame;
int worldWidth;
int worldHeight;
GlobManager globs;
int ticksSinceSpit;
void advanceFrame(Uint32 ticks);
Enemy& operator=(const Enemy&);
};
#endif