-
Notifications
You must be signed in to change notification settings - Fork 0
/
piece.cpp
executable file
·108 lines (82 loc) · 1.87 KB
/
piece.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
107
108
#include "piece.h"
position::position (int x, int y){
positionX = x;
positionY = y;
}
position::position(){
positionX = -1;
positionY = -1;
}
bool position::setPosition(int x, int y){
bool validRangeX = x < ciVerticalEnd && x >= ciVerticalBeginning,
validRangeY = y < ciHorizontalEnd && y >= ciHorizontalBeginning;
if ( validRangeX && validRangeY){
positionX = x;
positionY = y;
return true;
}
else
return false;
}
bool position::setPosition(position oldPosition){
bool value = setPosition(oldPosition.positionX, oldPosition.positionY);
return value;
}
int position::getPositionX(){
return positionX;
}
int position::getPositionY(){
return positionY;
}
void piece::setLife(int currentLife){
life = currentLife;
}
void piece::lostMyLife(){
if (life >= ciMinimumLife)
life--;
}
void piece::setCoordinates(position newPiecePosition){
coordinates.setPosition(newPiecePosition);
}
void piece::setCanItMove (bool isMoveable){
canItMove = isMoveable;
}
void piece::setSize(int pieceSize){
size = pieceSize;
}
position piece::getCoordinates(){
return coordinates;
}
bool piece::getCanItMove(){
return canItMove;
}
int piece::getSize(){
return size;
}
int piece::getALife(){
return life;
}
void piece::setRotation(rotation direction42){
direction = direction42;
}
rotation piece::getRotation(){
return direction;
}
piece::piece(){
}
piece::piece(int size, bool isMoveable){
setCanItMove(isMoveable);
setSize(size);
setLife(size);
}
piece::piece(position newPiecePosition, rotation newOrientation, int size, bool isMoveable){
setCoordinates(newPiecePosition);
setCanItMove(isMoveable);
setSize(size);
setLife(size);
setRotation(newOrientation);
}
staticPiece::staticPiece(){
}
dynamicPiece::dynamicPiece(){
}