So I am trying to implement saving and loading into my game, I can save a spatial but when I try to open it with jMonkey it gives an error opening j3o file and does not open.
This is my code that saves it:
[java]
saveTimer = saverTimer + tpf;
if (saveTimer > 10f) {
BinaryExporter exporter = BinaryExporter.getInstance();
if (range) {
file = new File("C:\\Users\\Administrator\\Desktop\\Projects\\LandOfAmaral3D\\Saves\\range.j3o");
}
if (melee) {
file = new File("C:\\Users\\Administrator\\Desktop\\Projects\\LandOfAmaral3D\\Saves\\Character_Plane.002.mesh.j3o");
}
if (mage) {
file = new File("C:\\Users\\Administrator\\Desktop\\Projects\\LandOfAmaral3D\\Saves\\mage.j3o");
}
try {
exporter.save(this.app.getRootNode(), file);
} catch (IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, "Error: Failed to save game!", ex);
}
player.setUserData("name", name);
player.setUserData("health", player.getHealth());
player.setUserData("strength", player.getStr());
player.setUserData("location", player.getWorldTranslation());
player.setUserData("gold", player.getGold());
saveTimer = 0;
}
[/java]
So it will save a j3o file in that directory, but when I try to open in jMonkey it gives me this: