-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPiece.cpp
88 lines (73 loc) · 1.04 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
#include "Piece.h"
#include <cstdlib>
Piecetype::Piecetype()
: orientation(0), whichPiece(9)
{
}
void Piecetype::setboundingBox(string s)
{
int k = 0;
for (int i = 0; i < 4; i++)
{
for(int j = 0; j < 4; j++)
{
boundingBox[i][j] = s.at(k);
k++;
}
}
}
void Piecetype::setCoordinate(int a, int b)
{
m_x = a;
m_y = b;
}
void Piecetype::moveUp()
{
m_y--;
}
void Piecetype::moveDown()
{
m_y++;
}
void Piecetype::moveLeft()
{
m_x--;
}
void Piecetype::moveRight()
{
m_x++;
}
int Piecetype::getX()
{
return m_x;
}
int Piecetype::getY()
{
return m_y;
}
void Piecetype::setWhichPiece(int x)
{
whichPiece = x;
}
void Piecetype::changeOrientation()
{
if (orientation < 3)
orientation++;
else
orientation = 0;
}
int Piecetype::getOrientation()
{
return orientation;
}
int Piecetype::getWhichPiece()
{
return whichPiece;
}
string Piecetype::getCurrentPieceAndOrientation()
{
return myPieces[whichPiece][orientation];
}
Piecetype::~Piecetype()
{
}