-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap.cpp
More file actions
60 lines (54 loc) · 1.67 KB
/
map.cpp
File metadata and controls
60 lines (54 loc) · 1.67 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
54
55
56
57
58
59
60
/** *********************************************************************************************************
RS_Mind
9/21/18
Overworld Render
Renders a map into the console. Intended to be used in other functions.
********************************************************************************************************* **/
#include <iostream>
#include <stdlib.h>
#include <vector>
using namespace std;
void render(int playerX, int playerY, int scaleX, int scaleY, vector< vector<int> >& explore, vector< vector<char> >& grid, char playerSprite, char unexplored)
{
explore [playerX][playerY] = 1; ///Exploration addition; default radius 1 orthogonally
if(playerX > 0)
{
explore [playerX-1][playerY] = 1;
}
if(playerY > 0)
{
explore [playerX][playerY+1] = 1;
}
if(playerX < scaleX-1)
{
explore [playerX+1][playerY] = 1;
}
if(playerY < scaleY-1)
{
explore [playerX][playerY-1] = 1;
}
system("CLS"); //Clear the console
for (int i = 0; i <= scaleY-1; i++) ///Render start
{
for (int j = 0; j <= scaleX - 1; j++)
{
if(j == playerX && i == playerY)
{
cout << playerSprite << " "; //Player sprite
}
else
{
if(explore[j][i] == 0)
{
cout << unexplored << " "; //Unexplored sprite
}
else
{
cout << grid[j][i] << " "; //Render space
}
}
}
cout << endl;
} ///Render end
return;
}