Treasure hunt Game

Hi Guys!

I've been asked to make a treasure hunt game.
Anyone wanna help me out with it, I've got some basic coding so far at home, so I cant put it here.

PM me or email: fakkle786@gmail.com

We can help but it would be best to get home and post the code or ask a specific question regarding what to code.
I'm back now

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
#include <iostream>
#include <list>
#include <random>

#define VK_NUMPAD8 0x68;
#define VK_NUMPAD2 0x62;
#define VK_NUMPAD6 0x66;
#define VK_NUMPAD4 0x64;

using namespace std;

extern int up       = 0;
extern int down     = 0;
extern int left     = 0;
extern int right	= 0;
extern int position[2] = { 0, 8 };
extern int option, x, y;


extern char character      = 'O ';

extern char mainGrid[8][9] = {	{ 'X','X','X','X','X','X','X','X', },
								{ 'X','X','X','X','X','X','X','X', },
								{ 'X','X','X','X','X','X','X','X', },
								{ 'X','X','X','X','X','X','X','X', },
								{ 'X','X','X','X','X','X','X','X', } };




void grid()
{
	for (int x = 0; x < 8; x++) {
		for (int y = 0; y < 8; y++) {
			if (x == position[0] && y == position[1])
				cout << character;
			else 
				cout << mainGrid[x][y];
			cout << " ";
			
		}	
		cout << endl;
	}
	
	cout << "Hit enter." << cin.get();
	position[1] = 1;
	system("cls");
	
	for (int x = 0; x < 8; x++) {
		for (int y = 0; y < 8; y++) {
			if (x == position[0] && y == position[1])
				cout << character;
			else 
				cout << mainGrid[x][y];
			cout << " ";
		}
		cout << endl;
	}
	cout << "Done! Press Enter." << cin.get();

}

int main()
{
	int option;

	cout << "1:  Play the game!			    \n";
	cout << "2:  Exit the game.				\n";
	cout << "\n";
	cout << "Please enter 1 of 2 options:	\n";
	cin >> (option);

	if (option == 1)
		grid();
	else
		return 0; // change
}


How would I get the character to move? Ive got the keyboard keys defined at the top, but I don't know how to put it into use.
1. You use extern too excessively without knowing what it means.
2. It can be done without :

1
2
3
4
#define VK_NUMPAD8 0x68;
#define VK_NUMPAD2 0x62;
#define VK_NUMPAD6 0x66;
#define VK_NUMPAD4 0x64; 


Actually these are specific for Windows-platform.

3. cin >> (option); is bad style. Should be cin >> option;

4. You don't have a function to drawBoard, a function for input, a function for processing a frame before you draw the board. Mixed functions are unclear and considered bad style.
Topic archived. No new replies allowed.