This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I am making a idle game i want to make a offline progress system like all idle games but i dont know how i compare and i dont know how calculate it for the player get the money

Godot version 3.5.1
in Engine by (24 points)

1 Answer

+1 vote
Best answer

A simple way would be to use the result of Time.get_unix_time_from_system() as your base time value. That's a value representing "elapsed seconds" since the Unix epoch time (Jan 1, 1970). It's easy to manage as it's just an integer value. So, if you store that value when someone quits your game, and you get a new copy of that value when the game starts, you'd have two points in time, each represented by an integer value.

From there, simply subtracting the first value from the second results in the number of real-time seconds that have elapsed between those two time stamps. Using that value, you can do whatever is appropriate in your game.

by (22,704 points)
edited by

Ok i will test later

Thanks man worked

this will be useful to me

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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.