My game reads a world file to see where to place blocks and such. Where do I place the text file where It can be assessed after publishing or exporting? Right now it is in "doc/World1-1.txt" and it works. But does not after doing such things.
public void startWorld()
{
File world = new File("doc/World1-1.txt");
try
{
boolean space = false;
int x = -12;
int y = 12;
FileReader fr = new FileReader(world);
char[] allAtOnce = new char[(int)world.length()];
int charsRead = fr.read(allAtOnce);
String buffer = "";
String tileNameStorage = "";
for ( int count = 0; count < world.length(); count++)
{
if ( allAtOnce[count] != '-' && allAtOnce[count] != ',' && allAtOnce[count] != '|' )
buffer += allAtOnce[count];
if ( allAtOnce[count] == ',' )
{
tileNameStorage = buffer;
buffer = "";
if ( !tileNameStorage.equals("NULL"))
{
// add all possible block interaction types
if ( tileNameStorage.charAt(tileNameStorage.length()-1) == 'S')
{
addObject(new BlockSolid(tileNameStorage.substring(0,tileNameStorage.length()-1)), x, y);
//System.out.println(tileNameStorage);
}
}
x += 24;
}
if ( allAtOnce[count] == '|' )
{
x = -12;
y += 24;
}
}
fr.close();//close the file
}
catch(IOException e)
{
System.out.println(e);
}
}