@Override public void render(float delta) { super.render(delta); time += delta; if (time > 15f) { // if the player doesn't do anything, go to MainMenuScreen after one minute this.dispose(); ((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenuScreen()); } }
// other overrides ---------------------------------------------------------------------------- @Override public void show() { super.show(); table.addAction( Actions.sequence(Actions.alpha(0), Actions.fadeIn(0.10f), Actions.delay(0.10f))); stage.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { if (time > 2f) { dispose(); ((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenuScreen()); } } }); }
@Override public void dispose() { time = 0f; super.dispose(); }