Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving game state #18

Closed
aleslanik2 opened this issue Aug 30, 2018 · 2 comments
Closed

Saving game state #18

aleslanik2 opened this issue Aug 30, 2018 · 2 comments

Comments

@aleslanik2
Copy link

Hi, i am begining developing simple game in flame. And i have no idea how to save game state in situation when application goes to background.
In current state, after moving back to foreground, is the game restarted.

Thank you for your reply and have a nice day

PS. Sorry for my English, my language skill is very poor :-)

@erickzanardo
Copy link
Member

Hello @aleslanik2 I don't if I quite understand what you are asking, but when the app is moved to background, it is not killed (at least on Android, I'm not sure about iOs) you could keep your state on memory and use the lifecycleStateChange method to resume the game from your state.

Another option is to save your state on the shared preferences of the device, flame doesn't provide any solution for this out of the box, but I can recommend this lib in order to achieve that.

Hope this helped, any other question, feel free to ask

@luanpotter
Copy link
Member

Perfectly put, @erickzanardo, thanks! I'm closing this issue, but please feel free to open new ones if necessary :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants