-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameObject.cpp
More file actions
55 lines (43 loc) · 1.03 KB
/
GameObject.cpp
File metadata and controls
55 lines (43 loc) · 1.03 KB
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
#include <iostream>
#include "GameObject.h"
#include "Point2D.h"
//documentation doesn't specify a default constructor
GameObject::GameObject() {
display_code = ' ';
state = 0;
id_num = 1;
cout << "GameObject constructed. " << endl;
}
GameObject::GameObject(char in_code) {
display_code = in_code;
state = 0;
id_num = 1;
cout << "GameObject constructed. " << endl;
}
GameObject::GameObject(char in_code, int in_id, Point2D in_loc) {
display_code = in_code;
state = 0;
id_num = in_id;
location = in_loc;
cout << "GameObject constructed. " << endl;
}
GameObject::~GameObject() {
cout << "GameObject destructed. " << endl;
}
Point2D GameObject::GetLocation() {
return location;
}
int GameObject::GetId() {
return id_num;
}
char GameObject::GetState(){
return state;
}
void GameObject::ShowStatus() {
//check sample output
cout << display_code << id_num << " at " << location;
}
void GameObject::DrawSelf(char *ptr) {
*ptr = display_code;
*(ptr+1) = '0' + id_num;
}