I am creating a text adventure game in which the player goes around different rooms - all done in Visual Studio.
I am required to do a map (.csv) from which the 2D array will "read" from to proceed onto the different rooms. A letter on the outside (lets take X) would not let the player pass.
It would look something like this for example:
x x x x x
x x Mountain x
x Hills Shack x
x x x x x
Now, I have all my different rooms set up (as classes) with all the headers in place.
I am totally lost with how I am meant to make the 2D array work with the rooms, so that when the player moves to the Shack room from the Hills room (switch case East for example), the array would move the player +1 to the right.
I hate to ask but would anyone be willing to help me out with the coding side of things? I only understand that I would put all the stuff such as the lines of text that the player will read, within the classes (rooms), then reference the rooms in the main but I still would not have any idea on how to write the code so that it all fits together.
If I did not explain it very well, I am very sorry as I am completely lost in where to go and I will make sure to give a more in-depth explanation if required to.
The way you have described your program is going to make it difficult for us to help you. We don't have code to help you with, and you haven't asked a specific question (only "help me out", which doesn't tell us how we can help). Don't take this as me being harsh - I'm just explaining why it's going to be hard for us to help you.
I suggest trying to break up your program into small problems that you can solve. That's going to be difficult without knowing everything about how your program should work, but you can start with this:
* Declare the 2D array (if you haven't done that already)
* Make the game start in a valid location
* Go one direction and make sure you end up in the correct place
* Make sure you can go back the direction you came and it works
* Make sure you can't go to a location that has an X in it
If you would like to do this in a tutoring session, you can send me a private message or email me at tim@mycpptutor.com.
If you want to do this over cplusplus.com, I suggest writing up some code and posting it here, then asking a question about a specific line or some function/class that doesn't work.