Hi,
I’m making an idle game and i want to add a coin boost/multiplier which you can buy in the shop. How can I program a coin boost/multiplier? I have a offline reward too and if the boost/multiplier is on you should earn more offline reward.
Thank you for answer!
I suppose that you aren’t getting this time from server, so a multiplier will be something simple as: (currentVisitInDateFormat - lastVisitInDateFormat).ConvertDateToSeconds() * myBoostMultiplier
Ok, thank you.
And how can I make it with a limited time?
Example: myBoostMultiplier is only for 1 Hour and my offline is about 2 Hour (currentVisitInDateFormat - lastVisitInDateFormat).ConvertDateToSeconds())
So i need to multiplier only 1 Hour of the “offline Time” and maybe the player played about 30 min before, so that the multiplier only is about 30 min left.
This → (currentVisitInDateFormat - lastVisitInDateFormat).ConvertDateToSeconds(), will give to you the answer in seconds, you can do any kind of limitation with this information, if you want to apply something on the first hour remove 3600 seconds from total and apply your custom modifiers, then on rest do something else.
You need to record information on it. When they purchase it, record a timestamp and which one was bought or used. Then if the user goes offline and logs back in, you get a new datetime. Calculate the amount of time difference and then you can calculate the time that should go towards the boost. (which @Nefisto has given you the formula)
Ok, thank you all!