- Home /
Energy or lives regen by time
Hi I´m trying to make a mobile game for android and IOS, but I don't know how to make a timer so that even if you are out of the app the time stills running and every certain time you regenerate 1 live or 1 point of energy (like candy crush). I haven´t found anything about it :( please help
"When you are out of the app"
I believe the expected way to do this involves measuring the time elapsed when you start the application. In other words, record the time you last quit the application. Read that value when the application starts. Use System.DateAndTime math to find the real elapsed time and use it as desired.
For a micro-transaction game or game where points and leaderboards matter, this will not suffice, since people can change their date-and-time settings on their computer to fool the game. In such cases, these calculations are done server-side (on your company's server).
Answer by Cyber_Balls · Jan 20 at 09:24 AM
Hey @ccampos93 , I know I'm late to the party but I found this thread in case you're still in need of this info
https://www.reddit.com/r/gamedev/comments/mc37fj/regenerate_lives_based_on_irl_time_in_unity/
Your answer
Follow this Question
Related Questions
Heart/Energy system 1 Answer
Lives = play 0 Answers
Convert this string formatting from C# to JS 1 Answer
Start timer with trigger 1 Answer
I want particle to emit for one second after my mouseclick 1 Answer