Hello everyone. This is my first post here. I am only posting here under the most extreme circumstances because I cannot for the life of me figure out how to make my save function for RPG game to work. So for it will only save in the first room. So I tried making different ttext files for each room. Let's say I save in the second room. While the program will write down the coordinates and other data to the text when I try to continue it will only bring up the save I did in the first room. I am almost done my game and I love to get this problem fixed so any help will be greatly appreciated. By the way I am using VS 2008 C++professional edition.

Here is the code

//Author Hector Rosario
 

#include <iostream>
#include <stdio.h>
#include <windows.h>
#include <stdlib.h>
#include <conio.h>
#include <ctype.h>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <string>
#include <time.h>

using namespace std;

//my void functions
void drawMaze();
void Maze1();
void cokeparty();
void room1();
void room2(); 
void drawRoom();
void help();
void newRoom(); 
void input();
 void input2();
 void input3();
void mainMenu();
 void continueGame();
 
 
 //My chars      
char guy = 1; //our hero
 
string playerName;    
 //my ints
int move; //input for movement
	  int x = 14; //starting x value on room one for main character
      int y = 8; //starting y value on room one for main character
	  int m = 6;//starting x value on room two for main character
	  int n = 1;//starting y value on room two for main character
	  int g = 22;//starting x value on  Mazeone for main character
	  int h=  1;//starting y value on Mazeone for main character
	  int life = 100;
   
	  //Define default game board 
	  
	  const int ROWS = 15; //constant row value for array
      const int COLUMNS = 22; // constant column value for array
 
      unsigned char room[ROWS][COLUMNS] =
      // 0    1    2    3    4    5    6    7    8    9    10  11   12   13   14   15   16   17   18   19   20  21
      {{'#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#','#'}, //0
	   {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#','#'}, //1
	   {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#','#'}, //2
	   {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#','#'}, //3
	   {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#','#'}, //4
	   {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#','#'}, //5
	   {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',' '}, //6
	   {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#','#'}, //7
	   {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#','#'}, //8
	   {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#','#'}, //9
       {'#', '#', '#', ' ', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#','#'}, //10
	   {'#', '#', '#', ' ', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#','#'}, //11
       {'#', '#', '#', ' ', ' ', ' ', ' ', ' ', ' ', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#','#'}, //12
	   {'#', '#', '#', '#', '#', '#', '#', '#', ' ', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#','#'}, //13
	   {'#', '#', '#', '#', '#', '#', '#', '#', ' ', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#','#'}}; //14
      
     
	  
	    
 
 	 unsigned char roomtwo[ROWS][COLUMNS] =
      // 0    1    2    3    4    5    6    7    8    9    10  11   12   13   14   15   16   17   18   19   20  21
      {{'#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#','#'}, //0
	   {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#','#'}, //1
	   {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#','#'}, //2
	   {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#','#'}, //3
	   {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#','#'}, //4
	   {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ','#'}, //5
	   {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#','#'}, //6
	   {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#','#'}, //7
	   {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#','#'}, //8
	   {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#','#'}, //9
       {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', '#', '#', '#', '#', '#', ' ', '#', '#', '#', '#', '#','#'}, //10
	   {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', '#', '#', '#', '#', '#', ' ', '#', '#', '#', ' ', ' ','#'}, //11
       {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', '#', '#', '#', '#', '#', ' ', ' ', '#', '#', ' ', '#','#'}, //12
	   {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#', '#', '#', '#', '#', '#', '#', ' ', ' ', ' ', ' ', '#','#'}, //13
	   {'#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#','#'}}; //14
	 
	  const int Horizontal = 24; //constant row value for array
      const int Vertical = 40; // constant column value for array
	 
		unsigned char mazeone[Horizontal][Vertical] =
		// 0   1   2   2   4   5   6   7   8   9   10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39   
		{{'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-'}, //0
		 {'|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'}, //1
		 {'|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'}, //2
		 {'|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'}, //3
		 {'|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'}, //4
		 {'|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'}, //5
		 {'|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'}, //6
		 {'|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'}, //7
		 {'|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'}, //8
		 {'|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'}, //9
		 {'|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'}, //10
		 {'|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'}, //11
		 {'|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'}, //12
		 {'|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'}, //13
		 {'|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','/','-','-','-','-','-','-','-',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'}, //14
		 {'|',' ',' ','/','-','-','-','-','-','-',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'}, //15
		 {'|',' ',' ','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|',' ','/','\\',' ','/','-','-',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'}, //16
		 {'|',' ',' ','|',' ','/','-',' ','-','-','-','-','-','-','-','-','-','-','\\',' ','|',' ','|','|',' ','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'}, //17
		 {'|',' ',' ','|',' ','|','|',' ','|',' ',' ',' ',' ',' ',' ',' ',' ',' ','|',' ','|',' ','|','|',' ','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'}, //18
		 {'|',' ',' ','|',' ','|','|',' ','|',' ','-','\\','-','-',' ','-','-',' ','\\','-','/',' ','|','\\','-','-',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|',' ','|'}, //19
		 {'|',' ',' ','|',' ','|','|',' ','|',' ',' ','|',' ',' ',' ','|',' ',' ',' ',' ',' ',' ',' |',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|',' ','|',' ','|'}, //20
		 {'|','-','-','/',' ','|','|',' ','\\','-','-','/',' ','|',' ','|','-','-','-','-','-','-','/',' ','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','\\','-','/',' ','|'}, //21
		 {' ',' ',' ',' ',' ','/','\\',' ',' ',' ',' ',' ',' ','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'}, //22
		 {'|','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-'}}; //23
 
		 
		 


	 int loop = 0;
 
	int main()
{
 
 
HANDLE hStdout;
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hStdout, BACKGROUND_GREEN); //Makes welcome text green.
    
cout << "Welcome!"<<endl;	
Beep(523,500); // 523 hertz (C5) for 500 milliseconds
Beep(587,500);
Beep(659,500);
Beep(698,500);
Beep(784,500);
     
	
mainMenu();





while(loop == 0)
      {
          
	   room[x][y] = guy; //Starting point for main character
	   drawRoom();
	   input();
	  if (room[6][21]!= ' ')//coordinates to leave room one
{  
		
	 
	room2();//takes me to room 2

           }	   
      }

      return 0;
}


void mainMenu()
{
    int menuLoop = 1;
    char menuSelect;
    int number[4]= {0};
   
    cout << "Rated C for COOL\n\n" << endl;
        system("pause");
        system("cls");
   
    while(menuLoop == 1)
    {
        //get player input
		cout << "Legend of Heroes 4 and a half: Off to the Coke PARTy" << endl;
        cout << "\n";
        cout << "(s) start new game" << endl;
        cout << "(c) continue saved game" << endl;
        cout << "(q) quit" << endl;
        cout << "(h) help" << endl;
        cout << "Your Selection: " << endl;
        cin >> menuSelect;

        switch(menuSelect)
        {
        case 's':
        case 'S':
            system("cls");
            cout << "Please enter your name: " << endl; //get player info to start new game
            cin >> playerName;
            menuLoop = 0;
            break;

        case 'c':
        case 'C':
           
           
               continueGame(); // goes to void continue
 
            
            menuLoop = 0;
            break;

        case 'q':
        case 'Q':
            //quit
            loop = 0;
            loop = 0;
            break;

        case 'h':
        case 'H':
            //display help function
            help();
            break;

        default:
            system("cls");
            cout << "Invalid Selection!" << endl;
            system("pause");
            break;
        }
    }

}
void continueGame()//I think my problem is here...
{
 //open save file for previous matrix position and health
 	
if (guy == room[x][y])
 {
	ifstream continueData;
	continueData.open("save.txt");
	continueData >> playerName >> life >> x >> y;//continue for room one
  continueData.close();
 }
					
 
if ( guy == roomtwo[m][n])
				{
ifstream continueRoomtwo;
	continueRoomtwo.open("savetwo.txt");
continueRoomtwo >> playerName >> life >> m >> n;  //continue for room two
				 continueRoomtwo.close();
				}
				
				
if (guy == mazeone[g][h])
{	

	ifstream continueMazeone;//continue for Mazeone
continueMazeone.open("savethree.txt");
continueMazeone >> playerName >> life >> g >> h;
 continueMazeone.close();
}			
}	
 
 
/***** Movement And Input Function *****/
void input()
{
 
{
      //Get user input to determine new coordinates
	  move = _getche();
      
	switch(move)
     {
     case 'a':
     case 'A':
          y--;

          if(room[x][y] == ' ')//collision detection and life detection
          {
            

           room[x][y] = guy; //draw new position
           room[x][y + 1] = ' '; //clear old position
           break;    
          }

          else
         
              y++;
              break;
	

     case 'd':
     case 'D':
          y++;

          if(room[x][y] == ' ')
          {
             

           room[x][y] = guy;
           room[x][y - 1] = ' ';
           break;
          }

          else
         
              y--;
              break;


     case 's':
     case 'S':
          x++;

          if(room[x][y] == ' ')
          {
            

           room[x][y] = guy;
           room[x - 1][y] = ' ';
           break;
          }

          else

            x--;
            break;

     case 'w':
     case 'W':
          x--;

          if(room[x][y] == ' ')
          {
           
          
           room[x][y] = guy;
           room[x + 1][y] = ' ';
                          
           break;
          }

          else

              x++;
              break;

	  case 'z':
     case 'Z':
       
         {
             //save player name, life, and current coordinates on the board
             ofstream saveGame;
             saveGame.open("save.txt");
             saveGame << playerName << " " << life << " " << x << " " << y << endl;
             saveGame.close();
         }
         system("cls");
         cout << "Game Saved\n\n" << endl;
         system("pause");
         break;
	  
	  case 'h':
	  case 'H':
			//Invoke help function
			help();
			break;

      case 'q':
	  case 'Q':
		      //Assign new value to loop variable and exit the game
              loop = 1;
              break;

                 
      }
    
 
}
}   
	  
 void input2()
 {
 
{
      //Get user input to determine new coordinates
	  move = _getche();
      
	switch(move)
     {
 case 'a':
     case 'A':
          n--;

          if(roomtwo[m][n] == ' ')//collision detection and life detection
          {
            

           roomtwo[m][n] = guy; //draw new position
           roomtwo[m][n + 1] = ' '; //clear old position
           break;    
          }

          else
         
              n++;
              break;
case 'd':
     case 'D':
          n++;

          if(roomtwo[m][n] == ' ')
          {
             

           roomtwo[m][n] = guy;
           roomtwo[m][n - 1] = ' ';
           break;
          }

          else
         
              n--;
              break;
case 's':
     case 'S':
          m++;

          if(roomtwo[m][n] == ' ')
          {
            

           roomtwo[m][n] = guy;
           roomtwo[m - 1][n] = ' ';
           break;
          }

          else

            m--;
            break;
case 'w':
     case 'W':
          m--;

          if(roomtwo[m][n] == ' ')
          {
           
          
           roomtwo[m][n] = guy;
           roomtwo[m + 1][n] = ' ';
                          
           break;
          }

          else

              m++;
              break;
	case 'z':
     case 'Z':
       
         {
             //save player name, life, and current coordinates on the board
             ofstream saveRoomtwo;
             saveRoomtwo.open("savetwo.txt");
             saveRoomtwo << playerName << " " << life << " " << m << " " << n << endl;
             saveRoomtwo.close();
         }
         system("cls");
         cout << "Game Saved\n\n" << endl;
         system("pause");
         break;
	  
	  case 'h':
	  case 'H':
			//Invoke help function
			help();
			break;

      case 'q':
	  case 'Q':
		      //Assign new value to loop variable and exit the game
              loop = 1;
              break;

                 
      }
    
 
}
}   
void input3()
 {
 
{
      //Get user input to determine new coordinates
	  move = _getche();
      
	switch(move)
     {
 case 'a':
     case 'A':
          h--;

          if(mazeone[g][h] == ' ')//collision detection and life detection
          {
            

           mazeone[g][h] = guy; //draw new position
           mazeone[g][h + 1] = ' '; //clear old position
           break;    
          }

          else
         
              h++;
              break;
case 'd':
     case 'D':
          h++;

          if(mazeone[g][h] == ' ')
          {
             

           mazeone[g][h] = guy;
           mazeone[g][h - 1] = ' ';
           break;
          }

          else
         
              h--;
              break;
case 's':
     case 'S':
          g++;

          if(mazeone[g][h] == ' ')
          {
            

           mazeone[g][h] = guy;
           mazeone[g - 1][h] = ' ';
           break;
          }

          else

            g--;
            break;
case 'w':
     case 'W':
          g--;

          if(mazeone[g][h] == ' ')
          {
           
          
           mazeone[g][h] = guy;
           mazeone[g + 1][h] = ' ';
                          
           break;
          }

          else

              g++;
              break;
	case 'z':
     case 'Z':
       
         {
             //save player name, life, and current coordinates on the board
             ofstream saveMazeone;
             saveMazeone.open("savethree.txt");
			 saveMazeone << playerName << " " << life << " " << g << " " << h << endl;
             saveMazeone.close();
         }
         system("cls");
         cout << "Game Saved\n\n" << endl;
         system("pause");
         break;
	  
	  case 'h':
	  case 'H':
			//Invoke help function
			help();
			break;

      case 'q':
	  case 'Q':
		      //Assign new value to loop variable and exit the game
              loop = 1;
              break;

                 
      }
    
 
}
}   	   
	 void room1()
 {  
	  int x = 5; //starting x value on game board for main character
      int y = 21;
	   
	    
	 
	   while(loop == 0)
      {
       
	   room[x][y]; //Starting point for main character
	   drawRoom();
	   input();
	   
	   if (room[6][21]!= ' ')
	   {
		   room2();}//returns me to room 2
 
 }
 }
 void room2()
 {
    
	  
	  int m = 6; //starting x value on game board for main character
      int n = 1;
	   system("cls");
           
            cout << "\n" << guy << " On to the coke PARTYYYYYY!!!!!!!!  " <<endl;
	    
	 
	   while(loop == 0)
      {
       
	   roomtwo[m][n]; //Starting point for main character
	   newRoom();
	 input2();
	   if (roomtwo[6][0]!= ' ')
	   {room1();}//returns me to room 1
		if (roomtwo[11][20]!= ' ')
	   {Maze1();}//takes me to mazeone
	   }
	   
 
 }
 
 void Maze1()
 {  
	  int g = 22; //starting x value on game board for main character
      int h = 1;
	 
	  while(loop == 0)
	  {
		  mazeone[g][h]; //Starting point for main character
	   drawMaze();
	    input3();
	 if (mazeone[22][0]!= ' ')
	   {
		   room2();}//returns me to room 2
 
 }
 }
 
 
 /***** Refresh Screen Function *****/


 void drawRoom() 
{
      
	// Red on White
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
			FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
			FOREGROUND_RED);
	system("cls"); 
	  
	  //Draw game board from room array variables
      for(int i = 0; i < ROWS; ++i)
      {
            for(int j = 0; j < COLUMNS; ++j)
                  cout << room[i][j];
            cout << endl;
	  }
 cout << playerName << endl;
    cout << "\nLife Remaining: " << life << endl;
      cout << "\nAfter movement() function, x = " << x << " y = " << y << endl;
	  cout << "\n(h)elp!!!" << endl;
      cout << "(q)uit game" << endl;
}
 void newRoom() 
{
      
	// Red on White
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
			FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
			FOREGROUND_RED);
	system("cls"); 
	  
	  //Draw game board from room array variables
      for(int i = 0; i < ROWS; ++i)
      {
            for(int j = 0; j < COLUMNS; ++j)
                  cout << roomtwo[i][j];
            cout << endl;
	  }
 cout << playerName << endl;
    cout << "\nLife Remaining: " << life << endl;
      cout << "\nAfter movements() function, x = " << m << " y = " << n << endl;
	  cout << "\n(h)elp!!!" << endl;
      cout << "(q)uit game" << endl;
}
 void drawMaze()
 { 
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
			FOREGROUND_GREEN | FOREGROUND_BLUE);
system("cls"); 
	  
	  //Draw game board from room array variables
      for(int i = 0; i < Horizontal; ++i)
      {
            for(int j = 0; j <Vertical; ++j)
                  cout << mazeone[i][j];
            cout << endl;
	  }
 cout << playerName << endl;
    cout << "\nLife Remaining: " << life << endl;
      cout << "\nAfter movements() function, x = " << g << " y = " << h << endl;
	  cout << "\n(h)elp!!!" << endl;
      cout << "(q)uit game" << endl;
	  }
void help()
{
	//Display controls and info until user input
HANDLE hStdout;

    hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hStdout, FOREGROUND_BLUE);//makes welcome text blue.
	system("cls");

	cout << "Use the wasd controls to move your character" << endl;
	  
	cout << "w = move up\n";
	cout << "a = move left\n";
	cout << "s = move down\n";
	cout << "d = move right\n";
	cout << "z = save game\n";
	system("pause"); //wait for user input
}

suggestion: change the color of the help menu because it can't be read. Dark blue on black background is nearly impossible to read.

Why don't you just save the coordinates for all rooms then read all of them.

ifstream continueData;
continueData.open("save.txt");
continueData >> playerName >> life >> x >> y >> m >> n;
continueData.close();

<snip>
             ofstream saveGame;
             saveGame.open("save.txt");
             saveGame << playerName << " " << life << " " << x << " " << y;
             saveGame << m << " " << n << endl;
             saveGame.close();

It would have been much more practical if you had attached the many pages of code...
But just a few mistakes / tips:

  1. Dont use system("pause") : http://www.gidnetwork.com/b-61.html
  2. In your switch statement switch (move) you have including double the amount of cases than you actually need, just define it like this switch (tolower(move)) and have each case with just a lower case char.
  3. Format your code better!

Still got the same results. Did you type in the code and get it to work yourself? Because I had tried something to that effect before and had no luck.

Attached is the revised code that works. It only generates one file named save.txt. You should consolidate all those instance of using ofstream because in my code they all do the same thing.

Thanx for the code optimization Ancient Dragon. Now if I could just figure out how to get the program to recognize the difference between saving and continuing in the first room and saving and continuing in the others. I realize that I am probably sounding annoying already, but that making all those separate save texts was my attempt to get the program to recognize the difference between the rooms. But alas, it is always to the same effect. Hopefully I can figure out the solution soon. Or if somebody does please let me know!

I think I know what you want -- if I'm in the second room, save, quit, then resume the program should resume on the second room. Right?? If yes, then I think you need to save another piece of info in save.txt -- what room number the game is in.

Then in mainMenu()

case 'c':
        case 'C':
               continueGame(); // goes to void continue
               if(CurrentRoom == 2)
               {
                   roomtwo[m][n] = guy;
                   newRoom();
                   room2();
               }
//               else if(CurrentRoom == 3)
//                   room3();
            
            menuLoop = 0;
            break;

Thank you very much!! I post the cpp file so if anyone else needs help like I did they can get it here! You can consider this thread solved!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.