1
\$\begingroup\$

I am trying to switch to a GameScreen when the LinearVelocity of a Box2D - Object is x = 0. If it is so, I am using the setScreen() - Method by calling the main class. This works perfekt, but when the screen should change, it just flickers, which is most likely caused by the render() - method in the screen class. So my question is now, how to dipose that render method or how to dispose the whole screen class, so that I only the new screen appears! Thanks

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

The libGDX Game class delegates to a single Screen so if your game is flickering between the new Screen and the old Screen after you call Game.setScreen it is likely because the new Screen sets the old screen back.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks, that was what I supposed to be the problem. Do you know how to fix that? \$\endgroup\$ Commented Dec 11, 2015 at 16:43
1
\$\begingroup\$

I found the solution.

The problem was, that the new Screen was actually empty resulting in an emtpy render - method aswell.

\$\endgroup\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.