text oriented game-c++

Hello, I am new to C++ programming and I would like to create a text oriented game, a game without animation, where you type commands for your character, for example "go north"/"health". So far in the cplusplus.com tutorial I am at Compound Data Types --> Dynamic Memory.

I'm at a delay though, I don't know how to make the characters location/map of where the character can go. My idea was to make it so that the character could go NSEW (north,s,e,w), and have a random chance that an enemy of that characters level would appear, he/she would find treasure, etc.

This is the code i have so far:

#include <iostream>
using namespace std;

int main ()
{
string con, commmand;
cout << "MACINTYRE's GAME\n\n";

cout << "rules are:\n-you have 10slots in storage\n-you can go NSEW\n\nValid cammands are:\n-drop\n-north/n(includes other directions)\n-inventory\n-stats [item name]\n-mystats\nok? ";
cin >> con;

prompt:
cout << "\n>> ";
cin >> command;

/* set of IFs and ELSE IFs for commands
each if/else if uses a function

if not one of commands in ifs/else if
else
{
cout << "That is not a valid command."
goto prompt;
}
*/

return 0;
}

//functions for commands


Please, give me a hand with this.



Last edited on
A similar thread: http://cplusplus.com/forum/general/55867/#msg300407
Though there is a gazillion ways to do this. Your idea sounds good, especially if your a beginner.
Topic archived. No new replies allowed.