-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.h
61 lines (51 loc) · 926 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
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
#ifndef PLAYER_H
#define PLAYER_H
#include <vector>
#include "Includes.h"
#include "Constants.h"
#include "Laser.h"
class Player
{
public:
Player(Surface & surface, int speed = 2, int lives = 3)
:surface_(surface), speed_(speed), lives_(lives)
{
rect_ = image_.getRect();
}
void draw();
void build();
void move();
void down_y();
void up_y();
void left_x();
void right_x();
int get_x() const
{
return rect_.x;
}
int get_y() const
{
return rect_.y;
}
int get_w() const
{
return rect_.w;
}
int get_h() const
{
return rect_.h;
}
int get_gun_x() const;
int get_gun_y() const;
void lives(int lives);
int lives() const;
static int score;
private:
static Image image_;
Surface & surface_;
Rect rect_;
int speed_;
int lives_;
};
void fire();
#endif