Sync Device and Game Time

Is possible that the game shows the same time as the device its been played in. How can I do that? I want to add different animations for morning, afternoon and evening. If a person would open the game in the morning a certain animation would be in effect, and if he would open it in the evening the evening animation would come into effect. Is there a way to do this?

var currentTime = new Date();
currentTime = currentTime.getHours();



Also, even without Javascript, there is a built in expression for Time:

Time(“hour”) would basically be the same as the new Date()/.getHours() javascript function.

Thanks man very much!

I didn’t understand, how would you input that?

I mean, I don’t understand what you’re trying to do, so I can’t provide exact guidance on where you would use it, however you can use that expression for any action or condition that supports a number.

If you just want to display the current time, it’d be like, a text object where you modify the text through an event, but then set the text to ToString(Time(“Hours”) + “:” + Time(“Minutes”))

Or if you wanted to store, say, “This is the last hour of the day the user played” You could simply do “Change value of Global Variable “Last Played” = Time(“Hours”)” and it’ll store a global variable with the current hour of the day based off whenever you fire off the action.