-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.cpp
68 lines (54 loc) · 1.03 KB
/
Player.cpp
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
#include "Player.h"
#include <ncurses.h>
#include <unistd.h>
Player::Player(int row, int col) {
m_health = 2;
m_kills = 0;
m_row = row;
m_col = col;
m_alive = true;
m_symbol = '@';
}
int Player::get_row() const {
return m_row;
}
int Player::get_col() const {
return m_col;
}
int Player::get_kills() const {
return m_kills;
}
int Player::get_health() const {
return m_health;
}
char Player::get_sym() const {
return m_symbol;
}
char Player::get_shooting_dir() const {
return m_shooting_dir;
}
bool Player::is_alive() const {
return m_alive;;
}
void Player::add_kill(int amount) {
m_kills += amount;
}
void Player::take_damage() {
m_health -= 1;
if (m_health == 0) {
m_alive = false;
}
}
void Player::set_pos(int row, int col) {
m_row = row;
m_col = col;
}
void Player::set_shooting_dir(char dir) {
m_shooting_dir = dir;
}
bool Player::is_shooting() const {
return m_shooting;
}
void Player::set_is_shooting(bool value) {
m_shooting = value;
}