-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGame_Object.cpp
More file actions
61 lines (51 loc) · 986 Bytes
/
Game_Object.cpp
File metadata and controls
61 lines (51 loc) · 986 Bytes
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
#include <iostream>
using namespace std;
#include "Game_Object.h"
//Constructors
Game_Object::Game_Object(char in_code)
{
display_code = in_code;
id_num = 1;
state = 's';
location = Cart_Point();
cout << "Game_Object constructed" << endl;
}
Game_Object::Game_Object(Cart_Point in_loc, int in_id, char in_code)
{
display_code = in_code;
id_num = in_id;
state = 's';
location = in_loc;
cout << "Game_Object constructed" << endl;
}
// Member Functions
Cart_Point Game_Object::get_location()
{
return location;
}
int Game_Object::get_id()
{
return id_num;
}
char Game_Object::get_state()
{
return state;
}
void Game_Object::show_status()
{
cout << display_code << id_num;
}
Game_Object::~Game_Object()
{
cout << "Game_Object destructed." << endl;
}
void Game_Object::drawself(char* ptr)
{
ptr[0] = display_code;
ptr[1] = '0' + id_num;
}
//virtual function
bool Game_Object::is_alive()
{
return true;
}