Alchemy game

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 :laughing:

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.

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

is a nice solucion, but i have no idea how to do this :frowning:

hi
I’m new to Gdevelop so I don’t know much but think you can execute javascript, maybe you can get date and time with it, then you have the code to save data here
wiki.compilgames.net/doku.php/gd … -explained
then you read it and get time again and get how much time elapsed maybe in javascript too.

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

In JS you can use the Date object to get the current date and time:
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:
wiki.compilgames.net/doku.php/gd … =help-link

And then look in to how to store this value permanently using the storage events
wiki.compilgames.net/doku.php/gd … -explained
Or the new File system events:
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

Thank you guys! I Will try! ^^

Or wait for the next version, 4ian has added a way to get a timestamp:

Time("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:

(Time("timestamp") - Variable(saved_timestamp)) / 1000

:slight_smile: