-
Notifications
You must be signed in to change notification settings - Fork 0
/
Maze.cpp
114 lines (96 loc) · 1.88 KB
/
Maze.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
109
110
111
112
113
114
#include "Maze.h"
#include <iostream>
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
Maze::Maze()
{
//ctor
}
Maze::~Maze()
{
//dtor
}
/*Maze::Maze(int _width, int _height, int _spawnX, int _spawnY, int _exitX, int _exitY)
{
maxWidth = _width;
maxHeight = _height;
spawnX = _spawnX;
spawnY = _spawnY;
exitX = _exitX;
exitY = _exitY;
}
*/
void Maze::displayMaze()
{
cout << " " << endl;
for (int i = 0; i<17; i++)
{
cout << " ";
for (int j = 0; j<17; j++)
{
cout << maze[i][j] << "";
}
cout << endl;
}
return;
}
int Maze::getParticularMazeLocation(int yval, int xval)
{
if (maze[yval][xval] == blnk )
{
return 0;
}
else if (maze[yval][xval] == 'C')
{
return 1;
}
else if (maze[yval][xval] == 'K')
{
return 2;
}
else if (maze[yval][xval] == 'M')
{
return 3;
}
else
{
return 4;
}
}
int Maze::getSpawnX()
{
return spawnX;
}
int Maze::getSpawnY()
{
return spawnY;
}
int Maze::getExitX()
{
return exitX;
}
int Maze::getExitY()
{
return exitY;
}
void Maze::setPlayerLocation(Player* player, int _x, int _y) // Sets Player's Location on the maze
{
player->setxLocation(_x);
player->setyLocation(_y);
maze[_y][_x] = 'P';
return;
}
void Maze::setMonsterLocation(Monster* monster, int _x, int _y) // Sets Monster's Location on the maze
{
monster->setxLocation(_x);
monster->setyLocation(_y);
maze[_y][_x] = 'M';
return;
}
void Maze::setExit(int _exitX, int _exitY)
{
maze[_exitX][_exitY] = 'E';
return;
}