I'm writing a rogue like game for my cs class. Everything is running fine but I need to import the walls for the game. The coordinates for the walls are in 3 text files. How do I inport it to the correct position on screen.
This is the code i'm using but it isn't printing right on the screen.
Can you look over? Thank you!
Code:
bool loadData( int coordinates[MAX_ARRAY][MAX_ARRAY], int fileIndex, int &arraySize )
{
char fileOne[] = "lowlevel.txt";
char fileTwo[] = "midlevel.txt";
char fileThree[] = "highlevel.txt";
ifstream fin;
if ( fileIndex == 1 )
{
fin.clear();
fin.open( fileOne );
}
else if( fileIndex == 2 )
{
fin.clear();
fin.open( fileTwo );
}
else if( fileIndex == 3)
{
fin.clear();
fin.open( fileThree );
}
else
return false;
while ( fin.good() && arraySize < 100 )
{
fin >> coordinates[arraySize][arraySize];
arraySize++;
fin >> coordinates[arraySize][arraySize];
arraySize++;
}
fin.close();
return true;
}