-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplayer.h
More file actions
55 lines (45 loc) · 1.16 KB
/
player.h
File metadata and controls
55 lines (45 loc) · 1.16 KB
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
#ifndef __PLAYER_H__
#define __PLAYER_H__
#include "shootingSprite.h"
#include "collisionStrategy.h"
class Player : public ShootingSprite {
public:
Player(const std::string&);
virtual ~Player();
//Player& operator=(const Player&);
void draw() const;
void update(Uint32 ticks);
//const Drawable* getSprite(){return twoway;}
void moveForward() { forward = true; }
void moveBack() { back = true; }
void moveUp() { up = true; }
void moveDown() { down = true; }
void start();
void stop();
bool newcollideWith(const Drawable* d) const {
return strategy->execute(*this, *d);
}
void setCollisionStrategy(int index) {
strategy = strategies[index];
}
int scoreAdd() { return score=score+3; }
int scoreMin() {return --score; }
int getScore() const {return score;}
void setScore(const int s) {score = s;}
void reset();
private:
//TWMultiSprite *twoway;
const std::vector<Frame *> frames;
int worldWidth;
int worldHeight;
int frameWidth;
int frameHeight;
int count;
bool forward, back, up, down, flagStop,flag, physics;
int score;
std::vector<CollisionStrategy*> strategies;
CollisionStrategy * strategy;
Player(const Player&);
Player& operator=(const Player&);
};
#endif