0

This was orignally posted in C++ Foums:

Hey, I'm new to this forum.

I'm having trouble making a mapping/navigation type program.
Kind of like one where you type in "N" and you go north. But more complex, scince i'm creating an rpg. (In command prompt console) I need to have the map visible. I would need to add things and properties to certian positions on the map. I've already created a complexish battle system that works. (If you need me to post my program, I will.)

If anyone could get me started in the right direction at least, I would be very appreciative.

It would have to be non linear. I know how to make linear mapping programs, but what is the fun in that?

Here is an example of what I need my code to do:

You are here: x=14,y=18
|F|R|F|
|F|X|F|
|M|R|F|
F, Being Forests,
X, Being current position,
M, Being Mountian or somthing,
R, Being road or somthing.

cin>>input;
"N"
(The new map would perhaps look like this)
You are here: x=15,y=18
|F|T|F|
|F|X|F|
|F|R|F|
T, Being town.
Maybe there is a battle there, And I would access that code if there were.

If this helps any, please let me know.

1
Contributor
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Shinedevil
0
int x;
x = 2;
int y;
y = 2;
//Definition of MAP ARRAY//
char commandmpdir;
char N;
char W;
char S;
char E;
// 0123//
//0XXXX//
//1XXXX//
//2XXXX//
//3XXXX//
//TESTING//
string MAP[3][3];
MAP[0][0]= "|I|";
MAP[0][1]= "|I|";
MAP[0][2]= "|I|";
MAP[0][3]= "|I|";
MAP[1][0]= "|I|";
MAP[1][1]= "|G|";//thing
MAP[1][2]= "|R|";//thing
MAP[1][3]= "|I|";
MAP[2][0]= "|I|";
MAP[2][1]= "|M|";//thing
MAP[2][2]= "|F|";//thing
MAP[2][3]= "|I|";
MAP[3][0]= "|I|";
MAP[3][1]= "|I|";
MAP[3][2]= "|I|";
MAP[3][3]= "|I|";
goto maptest;
//Fisrt Lockup:
{
maptest:
cout<<MAP[y-1][x-1];cout<<MAP[y-1][x+0];cout<<MAP[y-1][x+1]<<endl;
cout<<MAP[y+0][x-1];cout<<MAP[y+0][x+0];cout<<MAP[y+0][x+1]<<endl;
cout<<MAP[y+1][x-1];cout<<MAP[y+1][x+0];cout<<MAP[y+1][x+1]<<endl;
Restart:
cout<<"Which Direction do you want to go in? N,S,E,W?"<<endl;
cin>>commandmpdir;

}

What happend? It locks up, too much memory being used? Can someone tell me?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.