0

I finished developing my game today with Libgdx but I encountered a weird problem:

I deployed my game to android but when I play the game on my device, if I press the back key, it closes the app but if I resume it by clicking on its icon, I have some serious bugs: the game art gets messy, the music is stopped, etc. But if I simply click the Home button during the game and then resumes, nothing happens!

It's like when the back key is pressed, all the values (static values) are gone or something.

Did someone else encountered this problem before? What should I do?

For the record, I have a Values class which holds static members of all the important values in the game (character size, entities size, speed, etc).

What should I do?

David Lasry
  • 1,407
  • 4
  • 26
  • 43

1 Answers1

0

You should use in the creation of the game (create() method)

Gdx.input.setCatchBackKey(true);

to catch the back key and prevent the bugs.

If that doesn't work try using in the creation of the game (create() method)

Gdx.input.setCatchMenuKey(true);

or both at once.