Hello friends.
I’m confused about a little issue. I’m finishing my game and I found a problem, when I start the Menu Screen/Game Screen I have a delay (only on Android) until everything start to run properly.
E.g: When I switch to the Game Screen I need to start in “pause state”, so the player can start the game itself manually when he feels everything is “loaded”. My character has a constant move (horizontal), so if I start the game directly, the player can move for some milliseconds before the player start the game itself.
I really think it can happen because I separated the Draw code and Calculate code inside of render(). The draw() is ALWAYS running and the calculate() is running inside a FPS independent movement code, this is great because I have the same movement speed when 10/20/30/60FPS, but in theory when the game/any_screen starts, the calculate() runs normally in the first frame and this is why the game “starts” few milliseconds before my device show me. In the Desktop version this is not perceivable because CPU/GPU/Memory is very fast.
My code is simple and always the same:
- Show()/Create(): stage, batch, viewport, initialize some variables…
- Render(): RunningState(draw, calc), PauseState(draw, calc).
I want to wait everything be loaded before render(), but in theory render() is only called after show()/create(), so my game is working properly, but how can I start the game itself or the calc() only when the device is prepared to run?
Other e.g: In the first screen, a logo appears with fadeIn-fadeOut, when I start the game on my Android device, I usually can see only the fadeOut or at least the end of fadeIn.