Ive tried using a timer in the render method but that just crashes my game, so how do I change screens after a certain amount of time after rendering.

  • \$\begingroup\$ You could have a counter accumulating the elapsed time and when that is greater than or equal to two seconds you change the screen. \$\endgroup\$
    – bornander
    Commented Dec 8, 2014 at 9:53
  • \$\begingroup\$ @bornander can you gave an example of how to do that im a bit of a newbie \$\endgroup\$
    – dan14941
    Commented Dec 8, 2014 at 12:45

1 Answer 1


Track the elapsed time in your Screen, then when a limit is reach as the Game instance to swap to your next screen;

public class MyScreen extends ScreenAdapter {    
  private final Game game;
  private float elapsed;

  public MyScreen(final Game game) {
    this.game = game;

  public void render(float delta) {
    elapsed += delta;

    // Render or do whatever you do here

    if (elapsed > 2.0) {
      game.setScreen(new MyOtherScreen(game));

For this I am assuming you're using http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/Game.html and http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/Screen.html.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .