-
You would be better using structures as you can then store different types of data about the same location for example:
Code:
struct location{
char description[255];
struct location *north_ptr;
struct location *east_ptr;
struct location *south_ptr;
struct location *west_ptr;
}
This structure contains a description of the location and pointers to the next location, so if the user selects north you load the location pointed to by north_ptr.
I know you said you didnt know much about pointers but you really need them, take some time out and read up on them as you will benifit greatly in your attempts to create any programs.
I am trying to write a text adventure too and I pull my hair out all the time, because going from location to location is the easy part it's making sense of user input and interacting with objects that is the hard part.
-
I was trying something like that only wiht classes using the example from the earlier page, but i just couldn't figure out what half the tears were and how to make them work, i need to order a book or something, the ones i have are orld so i've been relying on online tutorials. thats why i was going for something simpler. i'll try it, but i would still like it if someone could tell me what i did wrong on that example so i'll know if i ever need to use something like that again.
-
I see two problems:
1. You need to initialize x and y to zero.
2. Setting the MAP array values to the return value of cout is a nonsensical operation. Use something like if MAP[x][y] == 2, where 2 is a label designating a certain tile. But this isn't a very good way to do this.
And yeah, you really need to learn more of the basics before you can make a good text adventure. It's not an easy task, and if you do it before you've grasped the basics you'll probably just learn bad habits because you haven't learned the proper ways to do certain things.
-
heres my go I did it in c using structures so it's a bit longer than the others but what the hell
This only allows movement around rooms you still need to create a parser for the user input, thats when your brain will really hurt!
-
any suggestions on books i should get that would show me wher eu guys learned this styff in c++?