-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
53 lines (45 loc) · 1.91 KB
/
main.cpp
File metadata and controls
53 lines (45 loc) · 1.91 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
/** *********************************************************************************************************
RS_Mind
10/08/18
Overworld Map
Renders a map that a player can navigate in into the console. Intended to be used in other functions.
********************************************************************************************************* **/
#include <iostream>
#include <stdlib.h>
#include <vector>
#include "map.h"
using namespace std;
int main()
{
int scaleX = 5; ///Size of the grid horizontally
int scaleY = 5; ///Size of the grid vertically
int playerX = 2; ///Player starting location horizontal (grid starts at 0,0 in top left)
int playerY = 2; ///Player starting location vertical
char wallType = '/'; ///Character to represent walls; default: /
char playerSprite = '@'; ///Player sprite; default: @
char unexplored = '?'; ///Sprite for unexplored tiles; default: ?
vector< vector<char> > grid(scaleX, vector<char>(scaleY)); ///Grid generation, default character: '
for(int i = 0; i < scaleX; i++)
{
for(int j = 0; j < scaleY; j++)
{
grid[i][j] = '\''; ///<---- Change here
}
}
vector< vector<int> > explore(scaleX, vector<int>(scaleY)); ///Exploration generation, default setting: All unexplored
for(int i = 0; i < scaleX; i++)
{
for(int j = 0; j < scaleY; j++)
{
explore[i][j] = 0; ///<---- Change here
}
}
while(true) ///Game Loop
{
render(playerX,playerY,scaleX,scaleY,explore,grid,playerSprite,unexplored); //Render function
twoNumbers result = movementOrthagonal(playerX,playerY,scaleX,scaleY,explore,grid,wallType); ///Movement function, change "Cardinal" to "WASD", "Num", or "NumDiag" to change movement type
playerX = result.newX;
playerY = result.newY;
}
return 0;
}