-
Notifications
You must be signed in to change notification settings - Fork 1
/
player.h
57 lines (51 loc) · 1.3 KB
/
player.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
#ifndef PLAYER
#define PLAYER
#include "gamedata.h"
#include "frameFactory.h"
#include "twowayMultisprite.h"
#include "collisionStrategy.h"
#include "item.h"
class Player {
public:
Player(const string&);
virtual ~Player();
virtual void update(Uint32 ticks);
virtual void draw() const;
const Drawable* getSprite() const { return sprite; }
void setDamage(float dam) { damage = dam; }
float getDamage() const { return damage; }
void damageIncr(float amount = 1.0) { damage += amount; }
int getWorldHeight() const { return worldHeight; }
int getWorldWidth() const { return worldWidth; }
bool hasItem() const { return item!=NULL; }
void setItem(Item* it) { item=it; }
Item* getItem() const { return item; }
bool collideWith(const Drawable* d);
void stop();
void right();
void left();
void down();
void leftaccelerate();
void rightaccelerate();
void jump();
protected:
TwowayMultiframeSprite* sprite;
Player(const Player&);
private:
const Gamedata* gdata;
bool keyPressed;
int worldWidth;
int worldHeight;
Vector2f initialVelocity;
float width;
float height;
float damage;
CollisionStrategy* cStrat;
Item* item;
std::vector<Frame*> frames;
std::vector<Frame*> framesLeft;
std::string name;
void makeSprite();
Player& operator=(const Player&);
};
#endif