Hi,
I have built a text based adventure game.
The last thing I have to do (this is for an assignment), is ask the user if they want to play again.
So, I thought the code below would probably be the best way to do it, seeing as I don't need any data from the game they just played, i'd delete the game altogether
bool play = true;
char c;
while(play)
{
AdventureGame* g = new AdventureGame(fileName, widthAndHeight);
g->Run();
delete g;
system("stty raw -echo");
cin.get(c);
system("stty -raw echo");
if(c!='y')
{
break;
}
else
{
cout << 'y' << endl;
play=true;
}
}
But it's not working.
When the user presses 'y' to play again, the last screen from the last game is displayed, and then the user is instantly asked if they want to play.
What am I doing wrong here?
PS... the game itself and all other code works fine.
Thanks for your help,
Jim.