Exemplo n.º 1
0
  /**
   * Create and Test to see if the app is running as webstart or local app and select the
   * appropriate muffin type
   *
   * @param fileName name of muffin where data will be saved
   * @throws org.newdawn.slick.SlickException Indicates a failure to load the stored state
   */
  public SavedState(String fileName) throws SlickException {
    this.fileName = fileName;

    if (isWebstartAvailable()) {
      muffin = new WebstartMuffin();
    } else {
      muffin = new FileMuffin();
    }

    try {
      load();
    } catch (IOException e) {
      throw new SlickException("Failed to load state on startup", e);
    }
  }
Exemplo n.º 2
0
  @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);
  }