The information is good coming in. I debug it and get to the first writer and get a null exception, it is probably something very simple any comments and help would be appreciated.
public Json writeGame(Ship ship, Array<EnemyPlanes> enemyPlanesArray,
FinalEnemy finalEnemy,int Level, int Difficulty){
Json json = new Json();
json.writeValue("Level", Level);
json.writeValue("Difficulty", Difficulty);
json.writeObjectStart(Ship.class,null);
json.writeField(ship.position.x, "X", float.class);
json.writeField(ship.position.y, "Y", float.class);
json.writeField(ship.hits, "Hits", int.class);
json.writeField(ship.missiles_OnBoard, "Missiles", int.class);
json.writeField(Constants.PLANE_MISSILES_ALLOWED, "Max Missiles", int.class);
json.writeField(Constants.PLANE_BULLETS_ALLOWED, "Max Bullets", int.class);
json.writeObjectEnd();
return json;
}
The stack trace is as follows:
Exception in thread "LWJGL Application" java.lang.NullPointerException at com.badlogic.gdx.utils.Json.writeValue(Json.java:376) at com.howlers.areoplanewars.game.Management.GameSave.writeGame(GameSave.java:85) at com.howlers.areoplanewars.game.Stages.GameStage.(GameStage.java:103) at com.howlers.areoplanewars.game.Screens.GameScreen.(GameScreen.java:23) at com.howlers.areoplanewars.game.AreoplaneWars.create(AreoplaneWars.java:50) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:147) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:124)
This line is the problem, which means it is all a problem:
json.writeValue("Level", Level);