Game Status in Android Version

I am developing a game and I have questions about saving and resuming the game. Let's say I have 10 animated sprites that draw each frame (which moves from side to side), and every time I press the home button or back button and then return to my game, it starts drawing sprites in the starting position, and not in the position before backward / menu press.

  • Do I need to save every position of the sprite and animation in order to get the game where I left off to resume (using the Bundle, onSaveInstanceState and onRestoreInstanceState ())? Or it can be achieved in some other simpler way. I am using the lunarlander example.

Thanks for the answer.

Regards, J.

+5
source share
1 answer

Be sure to check out this link: Data Warehouse

You cannot store your data using the Bundle, because the Bundle only stores data when the application is running, so when your application is destroyed, all information from the Bundle will be lost. I use Shared Preferences, this is an easy and convenient way to solve your problem. You can learn more about this at the link above. Hope this was helpful to you. Good luck

+1
source

All Articles