forked from zhusim222/Bee-game
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplayer.h
33 lines (30 loc) · 854 Bytes
/
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
// Player.h
#ifndef PLAYER_H
#define PLAYER_H
#include "Subject.h"
#include "obstacle.h"
#include <vector>
#include "Observer.h"
#include <memory>
class Player : public Subject {
public:
Player(float x, float y, float speed);
void move_right();
void move_left();
float get_x() { return x; }
float get_y() { return y; }
float get_width() { return width; }
float get_height() { return height; }
float get_speed() { return speed; }
static int get_HP(){return HP;}
static void set_HP(int hp){HP = hp;}
void attach(Observer* observer) override;
void detach(class Observer* observer) ;
void notify(class Observer* observer, bool is_collision);
void notify_all_observers();
private:
float x, y, speed, width, height;
static int HP;
std::vector<Observer*> observers;
};
#endif // PLAYER_H