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\$
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.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Thanks, that was what I supposed to be the problem. Do you know how to fix that? \$\endgroup\$ – Niemand Dec 11 '15 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.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.