DUNGEON CRAWLER HELP!!

Apr 29, 2016 at 12:56am
I have just started with this dungeon crawler game and i am just trying to get the while loop to work. After i enter 'r', it will not print out the new grid. It just tells me to make a move.

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
#include<iostream>
#include<cstdlib>
#include<string>
using namespace std;






int main() {
	
	char grid[10][10] = { { '*','*','*','*','*','*','*','*','*','*',},
						  { '*',' ',' ',' ',' ',' ',' ',' ',' ','*',},
						  { '*',' ',' ',' ',' ',' ',' ',' ',' ','*',},
						  {	'*',' ',' ',' ',' ',' ',' ',' ',' ','*',},
						  {	'*',' ',' ',' ',' ',' ',' ',' ',' ','*',},
						  {	'*',' ',' ',' ',' ',' ',' ',' ',' ','*',},
						  {	'*',' ',' ',' ',' ',' ',' ',' ',' ','*',},
						  {	'*',' ',' ',' ',' ',' ',' ',' ',' ','*',},
						  {	'*',' ',' ',' ',' ',' ',' ',' ',' ','*',},
						  {	'*','*','*','*','*','*','*','*','*','*' } };


	char player = 'P', trap = 'X', goal = 'G',move;
	int x = 1, y = 1;
	grid[x][y] = player;
	grid[5][4] = trap;
	grid[8][8] = goal;


	
	for (int row = 0; row < 10; row++) {


		for (int column = 0; column < 10; column++) {
			cout << grid[row][column];
		}
		cout << endl;
	}
	bool gameon = true;
	do{
	
		cout << "move" << endl;

		cin >> move;

		if (move == 'r') {
			grid[x + 1][y] = player;
		}
	} while (!gameon);
	
	system("pause");
	return 0;

}
Apr 29, 2016 at 3:01am
Where in the while loop are you attempting to display the grid?
Apr 29, 2016 at 3:46am
I'm not. Should I though?
Apr 29, 2016 at 5:21am
If you want the grid to be displayed in the loop, and you're wondering why it isn't being displayed in the loop, I'm thinking that maybe you should display it in the loop.
Topic archived. No new replies allowed.