public static void saveHighscore(int newHigh) { highScoreSave.setNumber(highScoreName, newHigh); try { highScoreSave.save(); } catch (IOException e) { e.printStackTrace(); } highScore = newHigh; }
@Override public void initStatesList(GameContainer gc) throws SlickException { gc.setMaximumLogicUpdateInterval(50); gc.setIcon("resources/icon.png"); highScoreSave = new SavedState(highScoreName); try { highScoreSave.load(); } catch (IOException e) { e.printStackTrace(); } highScore = (int) highScoreSave.getNumber(highScoreName, 0); // add the menu addState(new MenuState(0, gc)); // add the settings addState(new SettingsState(1, gc)); // add ME level addState(new RunWorld(2, gc)); // add Campaign addState(new CampaignMode(3, gc)); // add Survival addState(new SurvivalMode(4, gc)); // add SplashState addState(new SplashState(5, gc)); ME.keyFullScreen = Keys.DEL; gcWidth = getContainer().getWidth(); gcHeight = getContainer().getHeight(); // start with the menu enterState(SurvivalMode); // enterState(SplashState); }