Restore game state in cocos2d-android

My game engine uses cocos2d-android framework.

If the action goes into the background and resumes (the onStop and onRestart overridden), how can I load the initial state of the game into the resumed CCScene (with player positions, sounds, colors, etc ..)

I tried the standard way - save the variables and load into onRestart .

My playing line: welcomescreen - menu1layer - menu2layer - gamelayer CCScene

Maybe?

What is the best solution to pause and resume the game after pressing the power key, for example?

+4
source share

Source: https://habr.com/ru/post/1411784/


All Articles