0 votes

I'm working on a small game where time should continue to pass at least half speed when the game is closed. How should I go about this? Like, how would I save the current time and compare it next time it's open?

asked Oct 4, 2019 in Engine by andersmmg (418 points)

1 Answer

0 votes
Best answer

Use OS.get_datetime() to get the time and save it to a file when you quit the game. When you open the game, load the file and use OS.get_datetime() again. Then compare the two results to get the variation of time.

More info: OS.get_datetime(), File class

answered Oct 5, 2019 by Gabriel (241 points)
selected Oct 5, 2019 by andersmmg

How would I do that when an Android game is closed or switched from?

I'm sorry, but I'm not familiar with mobile development yet. I just assumed that you had some kind of button to handle quitting and one to load. Have you tried Handling quit requests?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.