Switch state without blank screen


I wanna switch multiple states where sometimes the background is the same and sometimes not. When I do so, all objects are cleared. But I dont want this, as it leads to black screens which can issue bad UX. It even gets worse when the state has several packs to load. It would be cool to have a loading screen or somewhat instead of a black screen.

Anyone got something like this working? All I wanna do for now is replacing the black screen with a static image.


I don’t remeber seeing a black screen when switching to another state, how do you get that ?


Maybe you load all your assets once while booting or you have a minimum of assets?
However, while loading packs the screen stays black, obviously, when not all necessary assets have been loaded.


Oh I see you mean that you load your assets in the preload() method every time you move from a state to another instead of loading them once in a boot state


As long as the texture has been loaded once, you can add an image/sprite displaying the texture in a state’s init() or preload() method and should display even while the state is loading.


Is there no way to add the images that I want to be displayed between states to the world instead of the states? So when initializing and shutting down states, I do not have to care about loading, displaying and destroying the “state transition” images.

Edit: I stick to samme’s solution.


You can try adding an image to the game stage (which isn’t cleared between states). Just be careful that you put it on the bottom, below the game world.