Checking passed real world time

Get help using Construct 2

Post » Fri May 31, 2013 5:33 pm

When you play a social game or management game, you start to build something and turn off the game. After many hours you turn on the game and find the building is completed. How can I make this in C2, checking passed real world time including when the game is off? Maybe it will need server connection, but app like Tiny Tower doesn't need it. I'm gonna make native mobile game with CocoonJS. Is there any plugin or expressions that checking device's clock?
B
23
S
8
G
1
Posts: 172
Reputation: 2,780

Post » Fri May 31, 2013 5:52 pm

@shaircast I would appreciate you tagging me later on if you find the answer. This interests me also.
Thanks
B
20
S
7
G
4
Posts: 322
Reputation: 4,521

Post » Fri May 31, 2013 6:23 pm

You can get the time through javascript with the Browser.ExecJS expression. (@Sulli)

javascriptDateTime.capx (r132)
B
55
S
28
G
19
Posts: 1,520
Reputation: 25,540

Post » Fri May 31, 2013 6:27 pm

@ramones thanks!
B
20
S
7
G
4
Posts: 322
Reputation: 4,521

Post » Fri May 31, 2013 6:28 pm

@ramones could you not in theory just change your computer date/time and then 'fast forward'/cheat in your time-based games?
B
20
S
7
G
4
Posts: 322
Reputation: 4,521

Post » Fri May 31, 2013 6:40 pm

@Sulli Yep you'd need to get the time from a server if you wanted to avoid that.
B
55
S
28
G
19
Posts: 1,520
Reputation: 25,540

Post » Fri May 31, 2013 6:40 pm

You can use this. However, keep in mind that any user can modify their system clock at will and thus, "cheat". Using an external source to fetch time is recommanded for such games, but this require an active internet connection.
B
60
S
24
G
23
Posts: 934
Reputation: 17,528


Return to How do I....?

Who is online

Users browsing this forum: jwilkins, maordany, Phacanu and 11 guests