-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameObject.cpp
48 lines (37 loc) · 1.49 KB
/
GameObject.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
#include "GameObject.h"
/*----------------------------------------------------------------------------------------------*/
void GameObject::printPos() const {
cout << '(' << this->xPos << ',' << this->yPos << ')' << endl;
}
/*----------------------------------------------------------------------------------------------*/
// GETTERS:
/*----------------------------------------------------------------------------------------------*/
GameObject GameObject::getPosition() const {
return *this;
}
/*----------------------------------------------------------------------------------------------*/
int GameObject::getX() const {
return this->xPos;
}
/*----------------------------------------------------------------------------------------------*/
int GameObject::getY() const {
return this->yPos;
}
/*----------------------------------------------------------------------------------------------*/
// SETTERS:
/*----------------------------------------------------------------------------------------------*/
void GameObject:: setPosition(GameObject newPos) {
xPos = newPos.xPos;
yPos = newPos.yPos;
}
/*----------------------------------------------------------------------------------------------*/
void GameObject::setX(int newX)
{
this->xPos = newX;
}
/*----------------------------------------------------------------------------------------------*/
void GameObject::setY(int newY)
{
this->yPos = newY;
}
/*----------------------------------------------------------------------------------------------*/