This is PART of my GoldMiner class where the problem is occuring. I am getting a null pointer. I assume it is because of the way I declared my sceneController class.
private static Game game;
private static sceneController controller;
public static void main(String[] args)
{
Application.launch(GoldMiner.class, (java.lang.String[])null);
game = new Game();
running = true;
tick(); //Line 26
}
//Line 44: update();
private static void update()
{
controller.totalGoldLabel.setText(Float.toString(game.getTotalGold())); //Line 52
controller.currentGoldLabel.setText(Float.toString(game.getCurGold()));
}
Error
Exception in thread "main" java.lang.NullPointerException
at com.github.geodox.goldminer.GoldMiner.update(GoldMiner.java:52)
at com.github.geodox.goldminer.GoldMiner.tick(GoldMiner.java:44)
at com.github.geodox.goldminer.GoldMiner.main(GoldMiner.java:26)
Exception in thread "JavaFX Application Thread"
sceneController is just the FX Controller, and it is using the GoldMiner.game instance set up like Game game;
and being used like game.addGold(game.getPerClickGold());