Hey ive tried to learn C++ by myself at home and decided that the best way to motivate myself was creating ye old dos text game.
Im stuck at this so far and was wondering how can i improve my basic layout?
also since its a text game how could i add various characters and rooms?
how would i use an array for a maze? or struct for hero/monsters?
and how can i create a xp/hp that increases/decreases and saves? i/o?
Any one that helps is an instant dovahkiin :D
but any direction is appreciated
/*
Name: Gaze of the abyss
Copyright: copyright my ass
Author: xxx
Date: 28/11/11 03:43
Description: Run and read the About option
*/
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream> //necessary for file i/o
using namespace std;
void playgame()
{
cout << "North (N) or West (W) choose a direction."<<endl<<endl;
char direction;
cin>>direction;
switch(direction)
{
case 'n':
case 'N':
cout << "You head North"<<endl<<endl;
break;
case 'w':
case 'W':
cout << "You head West"<<endl<<endl;
break;
default:
cout<<"Invalid Character entered"<<endl<<endl;
cout<<"Press Space to continue";
break;
}
}
void Manual()
{
cout<<"\n===============================================";
cout<<"\n|---------------------------------------------|";
cout<<"\n|--------------------MANUAL-------------------|";
cout<<"\n|---------------------------------------------|";
cout<<"\n===============================================";
cout<<"\n";
cout<<"\n";
cout<<"\n";
cout<<" CONTENTS\n";
cout<<"\n";
cout<<"\n";
cout<<"CONTROLS\n";
cout<<"\n";
cout<<"Directions;\n";
cout<<"\n";
cout<<"N/n = North\n";
cout<<"E/e = East\n";
cout<<"S/s = South\n";
cout<<"W/w = West\n";
cout<<"\n";
cout<<"\n";
cout<<"\n";
cout<<"\n";
cout<<"\n";
cout<<"Press Space to continue\n";
}
void About()
{
cout <<"\n";
cout <<"\n";
cout <<"\n";
cout <<" Gaze of the Abyss\n";
cout <<"\n";
cout <<" 'When you stare into the abyss the abyss stares back at you.'\n";
cout <<" Friedrich Nietzsche\n";
cout <<"\n";
cout <<" A Compeling story into the venture of a lone soul\n" ;
cout <<" trapped in an subterranean abyss\n";
cout <<"\n";
cout <<"\n";
cout << " Gaze of the Abyss is an C++ project created and designed under.\n";
cout <<"\n";
cout <<" Bloodshed Software Dev-C++ 4.9.9.2\n";
cout <<"\n";
cout << " GNU GENERAL PUBLIC LICENSE\n";
cout << " Version 2, June 1991\n";
cout <<"\n";
cout << " Copyright (C) 1989, 1991 Free Software Foundation, Inc.\n";
cout << " 675 Mass Ave, Cambridge, MA 02139, USA\n";
cout <<"\n";
cout <<"\n";
cout<<"Press Space to continue\n";
}
void menu(){
char choice=-1;
while (choice !='4')
{
cout<<"\n";
cout<<"\n";
cout<<" Gaze of the Abyss\n";
cout<<"\n";
cout<<" By: xxx v 1.0\n";
cout<<"\n";
cout<<"\n";
cout<<"\n=====================";
cout<<"\n Main Menu |";
cout<<"\n=====================";
cout<<"\n 1 - Start New Game |";
cout<<"\n 2 - Manual |";
cout<<"\n 3 - About |";
cout<<"\n 4 - Quit |";
cout<<"\n=====================";
cout<<"\n";
cout<<"\n";
cout<<"\n Enter choice: ";
cin>>choice;
switch(choice)
{
case '1':
system("CLS");
playgame();
break;
case '2':
system("CLS");
Manual();
break;
case '3':
system("CLS");
About();
break;
case '4':
cout<<"Thank you for playing!\n"<<endl;
break;
default:
cout<<"Invalid Character entered\n";
cout<<"\n";
cout<<"Press Space to continue\n";
}
system("pause");
system("CLS");
}
}
int main()
{
cout<<"welcome";
menu();
return 0;
}