Ask here your questions to get help using GDevelop.
By Sinha
#70529 Hi everyone,
I'm trying to make an alchemy game, but I'm having doubts about how to do some things. So I have two questions.
first: in gdevelop is it possible to continue counting time even leaving the game? Example: a certain object takes a few minutes to get ready, but the person does not want to stay in the game waiting, is there a way to make the time pass even without being in the game?
And,
I would like to know if it is possible to do a scene scroll with the touch.
example: when I touch the screen and move it, the camera move too. I already tried to do something similar in gdevelop, but it did not work very well. If anyone knows how, please help me <3

Thanks, sinha :lol:
User avatar
By ddabrahim
#70530 I don't think it is possible to count time after quit the game. But what you can do is check the current time (actual date and time) when the player quit the game and check it again when the player starts the game and take in to account the difference. For example, if something takes 10 minutes to complete and the player quit and then start again 8 minutes later, take the time into account and reduce the remaining time to complete accordingly.

To drag the screen, take a look at the drag camera with mouse example.
User avatar
By xisco
#70552 hi
it is not possible to continie doing things when the app is closed unless you have a server app which is always running o the cloud and players use a client.
You can simulates as said, you can store time and when the game opens again calculate the elapsed time and update your game
User avatar
By ddabrahim
#70560
is a nice solucion, but i have no idea how to do this

In case you don't know JS, search for a tutorial:
https://alison.com/courses?query=javascript

In JS you can use the Date object to get the current date and time:
https://www.w3schools.com/jsref/jsref_obj_date.asp

And then read the official docs about how to access and read and write scene variables in JS to pass the value from JS to a scene variable in GD to be able to access it from events too:
http://wiki.compilgames.net/doku.php/gd ... =help-link

And then look in to how to store this value permanently using the storage events
http://wiki.compilgames.net/doku.php/gd ... -explained
Or the new File system events:
http://wiki.compilgames.net/doku.php/gd ... filesystem

Finally come up with a formula to calculate elapsed time in seconds. It need to be something like:

elapsedTime = currentTime - lastTime

Then use the "elapsedTime" to calculate how much time left to complete a task.

If Timer "TaskTimer" is greater than 600 - elapsedTime seconds : Task complete
User avatar
By Lizard-13
#70587 Or wait for the next version, 4ian has added a way to get a timestamp:
Code: Select allTime("timestamp")

Save this value on exiting game, when the game is open again, read the saved timestamp and get the seconds elapsed since exit with:
Code: Select all(Time("timestamp") - Variable(saved_timestamp)) / 1000

:)