Need some guidance on creating a 2 dimensional console base game

here is what i got so for my code.
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

#include <iostream>
#include <windows.h>
using namespace System;
using namespace std;
int refreshDisplay(int , int);
const char wHole = '@';
const char sTar = '*';
const char bHole = 'x';
const char player = 'P';
struct Player;
int programinfo();
void refreshDisplay (int , int);

int main()
{
    programinfo();
    // map dimensions from user//
    int max_X = 0;
    int max_Y = 0;
    cout << "What is the dimension of the field you want to play on?" << endl;
    cout << "width: ";
    cin >> max_X;
    cout << " Height: " << endl;
    cin >> max_Y;
    cout << endl;
    
    Player player;
	player.x = 1;
	player.y = 1;
    
	do
    {
        cki = Console::ReadKey( true );
        switch ( cki.Key )
        {
			case ConsoleKey::W: player.y--; DisplayMap(player); break;
                
			case ConsoleKey::S: player.y++; DisplayMap(player); break;
                
			case ConsoleKey::A: player.x--; DisplayMap(player); break;
                
			case ConsoleKey::D: player.x++; DisplayMap(player); break;
        }
    }
    while ( cki.Key != ConsoleKey::Escape );
    
return 0;
    
}

struct Player
{
	int x;
	int y;
}
void refreshDisplay (int max_X, int max_Y);
{
    for (int x =1; x < max_X; i++)
    {
        for (int y =1; y< max_y; y++)
            cout << '.';
    }
    
}

int programinfo()
{
    cout <<" The oblective of the game is for the player to move around a 2 dimensional playing field and capture the star withought falling into a black hole  or walking off the edge of the playing field. The controls are W = up S= down A=Left D=Right" <<endl;
}

need to some how implement 3 black hole X characters and 2 wormhole characters on field @ and a star *. all these char has to be randomly generated.
Last edited on
create an image buffer and loop across all pixels to display the image.
Topic archived. No new replies allowed.