-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.cpp
106 lines (87 loc) · 1.34 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#include "Player.h"
Player::Player(int x, int y, char symbol, int punti, int vite, int ammo) : Entity(x, y, symbol)
{
this->punti = punti;
this->vite = vite;
this->ammo = ammo;
this->prevy = y;
}
void Player::increaseX(int x)
{
prevy = this->y;
prevx = this->x;
Entity::increaseX(x);
}
void Player::decreaseX(int x)
{
prevy = this->y;
prevx = this->x;
Entity::decreaseX(x);
}
void Player::increaseY(int y)
{
prevy = this->y;
prevx = this->x;
Entity::increaseY(y);
}
void Player::decreaseY(int y)
{
prevy = this->y;
prevx = this->x;
Entity::decreaseY(y);
}
int Player::getPunti()
{
return punti;
}
void Player::setPunti(int pt)
{
punti = pt;
}
int Player::getVite()
{
return vite;
}
void Player::setVite(int vt)
{
vite = vt;
}
int Player::getAmmo()
{
return ammo;
}
void Player::addAmmo(int n)
{
ammo =ammo + n;
}
void Player::increasePunti(int pt)
{
if (pt > 0)
punti += pt;
}
void Player::decreaseVite(int vt)
{
if (vt > 0)
vite -= vt;
}
bool Player::fire()
{
if (ammo > 0)
{
ammo -= 1;
return true;
}
return false;
}
int Player::getPrevy() {
return this->prevy;
}
int Player::getPrevx() {
return this->prevx;
}
void Player::setPrevy(int y) {
this->prevy = y;
}
void Player::setPrevx(int x) {
this->prevx = x;
}