So long story short, I’m making a simple cookie clicker like game, and I think it would be essencial to have a system that checks how much time you were away and calculates how much money you would’ve earned, maybe adding a penalty but that’s a detail. Anyway, I’m kind of lost on how to implement that, I’m thinking about making autosaves that save the last time and date that the player openned the app, and then use it to calculate compared to the time that the player is at the moment of log-in. That’s my idea at least, but I have no idea as to how to do that, and I think there’s probably a better way of doing it than this one too. I’m open to all Suggestions and thank you for your time! (also sorry for any typos or spelling errors).
You can use the expression Time(“timestamp”) to get the current date/time in seconds.
Get the current date/time in seconds when you close the app and save it
Get the current date/time in seconds when you open the app.
Calculate the difference
Use the difference to calculate how much money the player earned since the app was closed.
For example if the player earn 10 credit every 60 seconds and the game was closed 60000 seconds ago then the player earned 60000/60 * 10 = 10,000 credit since the app was closed.